From 675eec2cac3585c6d23da79540d64dfb3d2fbe68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 27 Jun 2012 17:18:15 +0200 Subject: Room: fix _try_links, add specs --- lib/edoors/room.rb | 2 +- spec/room_spec.rb | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/edoors/room.rb b/lib/edoors/room.rb index decdb83..46eb6b4 100644 --- a/lib/edoors/room.rb +++ b/lib/edoors/room.rb @@ -156,7 +156,7 @@ module Edoors if pending_link p2 = @spin.require_p p.class p2.clone_data p - p2.apply_link! link + p2.apply_link! pending_link send_p p2 end pending_link = link diff --git a/spec/room_spec.rb b/spec/room_spec.rb index 3757951..c0b361e 100644 --- a/spec/room_spec.rb +++ b/spec/room_spec.rb @@ -220,15 +220,16 @@ describe Edoors::Room do attr_reader :count def receive_p p @count||=0 + ['0','1','2'][@count].should == p.next_dst @count += 1 end end door1 = Out.new 'door1', room0 - room0.add_link Edoors::Link.new('door0', 'door1') - room0.add_link Edoors::Link.new('door0', 'door1', 'keys', {'f0'=>'v0'}) - room0.add_link Edoors::Link.new('door0', 'door1', 'keys', {'f0'=>'v0','f1'=>'v1'}) - room0.add_link Edoors::Link.new('door0', 'door1', 'keys', {'f0'=>'v0','f1'=>'v2'}) - room0.add_link Edoors::Link.new('door0', 'door1', 'keys', {'f0'=>'v0','f2'=>'v1'}) + room0.add_link Edoors::Link.new('door0', ['door1','0']) + room0.add_link Edoors::Link.new('door0', ['door1','1'], 'keys', {'f0'=>'v0'}) + room0.add_link Edoors::Link.new('door0', ['door1','2'], 'keys', {'f0'=>'v0','f1'=>'v1'}) + room0.add_link Edoors::Link.new('door0', ['door1','3'], 'keys', {'f0'=>'v0','f1'=>'v2'}) + room0.add_link Edoors::Link.new('door0', ['door1','4'], 'keys', {'f0'=>'v0','f2'=>'v1'}) p = @spin.require_p Edoors::Particle p['f0']='v0' p['f1']='v1' -- cgit v1.1-2-g2b99