diff options
-rw-r--r-- | spec/evendoors_spec.rb | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/spec/evendoors_spec.rb b/spec/evendoors_spec.rb index 7fff64b..19e56b4 100644 --- a/spec/evendoors_spec.rb +++ b/spec/evendoors_spec.rb @@ -510,15 +510,25 @@ describe EvenDoors do room0 = EvenDoors::Room.new 'room0', nil room1 = EvenDoors::Room.new 'room1', room0 p = EvenDoors::Twirl.require_p EvenDoors::Particle - p.src = Fake.new p.set_dst! 'get', 'room0/nodoor' room1.send_p p p.action.should eql EvenDoors::ACT_ERROR p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_RRWD - p.dst.should be p.src + p.dst.should be room1.space + end + # + it "routing success (direct)" do + room0 = EvenDoors::Room.new 'room0', nil + door0 = EvenDoors::Door.new 'door0', room0 + p = EvenDoors::Twirl.require_p EvenDoors::Particle + p.src = Fake.new + p.set_dst! 'get', 'door0' + room0.send_p p + p.action.should eql 'get' + p.dst.should be door0 end # - it "routeting success" do + it "routing success (bubble up the direct door)" do room0 = EvenDoors::Room.new 'room0', nil room1 = EvenDoors::Room.new 'room1', room0 door0 = EvenDoors::Door.new 'door0', room0 @@ -530,6 +540,43 @@ describe EvenDoors do p.dst.should be door0 end # + it "route error: right room, no drill down (2xbubble up)" do + room0 = EvenDoors::Room.new 'room0', nil + room1 = EvenDoors::Room.new 'room1', room0 + room2 = EvenDoors::Room.new 'room2', room0 + room3 = EvenDoors::Room.new 'room3', room2 + door0 = EvenDoors::Door.new 'door01', room1 + p = EvenDoors::Twirl.require_p EvenDoors::Particle + p.src = Fake.new + p.set_dst! 'get', 'room0/room1/door01' + room3.send_p p + p.action.should eql EvenDoors::ACT_ERROR + p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_RRNDD + p.dst.should be p.src + end + # + it "routing success: no door name -> src" do + room0 = EvenDoors::Room.new 'room0', nil + door0 = EvenDoors::Door.new 'door0', room0 + p = EvenDoors::Twirl.require_p EvenDoors::Particle + p.src = door0 + p.set_dst! 'get' + room0.send_p p + p.action.should eql 'get' + p.dst.should be door0 + end + # + it "routing success: no door name -> src" do + room0 = EvenDoors::Room.new 'room0', nil + door0 = EvenDoors::Door.new 'door0', room0 + p = EvenDoors::Twirl.require_p EvenDoors::Particle + p.set_dst! 'get' + room0.send_p p + p.action.should eql EvenDoors::ACT_ERROR + p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_NDNS + p.dst.should be room0.space + end + # # end end |