summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 12:03:48 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 12:03:57 +0200
commit421df693dee1901961a4b780e2ec4ba70a84dcf5 (patch)
treebe40b650901a320d154ca8f601b4c1c334632c24 /spec
parent2bdb8ddbfa1412b35417c71297d64c3d2c0a2a03 (diff)
downloadedoors-ruby-421df693dee1901961a4b780e2ec4ba70a84dcf5.zip
edoors-ruby-421df693dee1901961a4b780e2ec4ba70a84dcf5.tar.gz
specs: increase Room#send_sys_p coverage
Diffstat (limited to 'spec')
-rw-r--r--spec/evendoors_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/evendoors_spec.rb b/spec/evendoors_spec.rb
index 2f5eb70..9785587 100644
--- a/spec/evendoors_spec.rb
+++ b/spec/evendoors_spec.rb
@@ -664,5 +664,41 @@ describe EvenDoors do
p1.should be p
end
#
+ it "system route error: system no destination" do
+ room0 = EvenDoors::Room.new 'room0', nil
+ p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ room0.send_sys_p p
+ p.action.should eql EvenDoors::ACT_ERROR
+ p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_SND
+ end
+ #
+ it "system route error: system no door no action" do
+ room0 = EvenDoors::Room.new 'room0', nil
+ p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ p.add_dsts ' '
+ room0.send_sys_p p
+ p.action.should eql EvenDoors::ACT_ERROR
+ p[EvenDoors::ERROR_FIELD].should eql EvenDoors::ERROR_ROUTE_SNDNA
+ end
+ #
+ it "system routing success: action only" do
+ room0 = EvenDoors::Room.new 'room0', nil
+ p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ p.set_dst! EvenDoors::SYS_ACT_ADD_LINK
+ room0.send_sys_p p
+ p.action.should eql EvenDoors::SYS_ACT_ADD_LINK
+ p.dst.should be room0.space
+ end
+ #
+ it "system routing success" do
+ room0 = EvenDoors::Room.new 'room0', nil
+ door0 = EvenDoors::Door.new 'door0', room0
+ p = EvenDoors::Twirl.require_p EvenDoors::Particle
+ p.set_dst! EvenDoors::SYS_ACT_ADD_LINK, 'room0/door0'
+ room0.send_sys_p p
+ p.action.should eql EvenDoors::SYS_ACT_ADD_LINK
+ p.dst.should be door0
+ end
+ #
end
end