summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 08:52:39 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 08:52:39 +0200
commit1200008d135ec248d6dd63327f6e6b46c0a1361d (patch)
treeb749a6083d70b22d482087ca048f4d8274a86283
parent76d484f567b30cef2a4ddea10348ac535adbd784 (diff)
downloadedoors-ruby-1200008d135ec248d6dd63327f6e6b46c0a1361d.zip
edoors-ruby-1200008d135ec248d6dd63327f6e6b46c0a1361d.tar.gz
specs: check dst on error
-rw-r--r--spec/evendoors_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/evendoors_spec.rb b/spec/evendoors_spec.rb
index 82d9809..5718538 100644
--- a/spec/evendoors_spec.rb
+++ b/spec/evendoors_spec.rb
@@ -455,6 +455,7 @@ describe EvenDoors do
room.send_p p
p.action.should eql EvenDoors::ACT_ERROR
p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_NDNS
+ p.dst.should be room.space
end
#
it "route error: no destination no links" do
@@ -464,35 +465,42 @@ describe EvenDoors do
room.send_p p
p.action.should eql EvenDoors::ACT_ERROR
p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_NDNL
+ p.dst.should be p.src
end
#
it "route error: top room, wrong room" 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', 'noroom/door'
room1.send_p p
p.action.should eql EvenDoors::ACT_ERROR
p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_TRWR
+ p.dst.should be p.src
end
#
it "route error: right room, wrong door" do
room = EvenDoors::Room.new 'room', nil
p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ p.src = Fake.new
p.set_dst! 'get', 'room/nodoor'
room.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
end
#
it "route error: right room, wrong door (bubble up)" 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
end
#
it "routeting success" do
@@ -500,6 +508,7 @@ describe EvenDoors do
room1 = EvenDoors::Room.new 'room1', room0
door0 = EvenDoors::Door.new 'door0', room0
p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ p.src = Fake.new
p.set_dst! 'get', 'room0/door0'
room1.send_p p
p.action.should eql 'get'