summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-27 17:18:15 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-27 17:18:15 +0200
commit675eec2cac3585c6d23da79540d64dfb3d2fbe68 (patch)
tree8aac9e816b197a01e0a6c7b288196e5f7ee86222
parent1d70922b515eb58eb5b312db86142b639b2b2485 (diff)
downloadedoors-ruby-675eec2cac3585c6d23da79540d64dfb3d2fbe68.zip
edoors-ruby-675eec2cac3585c6d23da79540d64dfb3d2fbe68.tar.gz
Room: fix _try_links, add specs
-rw-r--r--lib/edoors/room.rb2
-rw-r--r--spec/room_spec.rb11
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'