summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/evendoors_spec.rb45
1 files changed, 17 insertions, 28 deletions
diff --git a/spec/evendoors_spec.rb b/spec/evendoors_spec.rb
index 703739b..349497d 100644
--- a/spec/evendoors_spec.rb
+++ b/spec/evendoors_spec.rb
@@ -163,7 +163,7 @@ describe EvenDoors do
d1 = EvenDoors::Door.new 'door1'
p.dst.should be_nil
p.next_dst.should be_nil
- p.add_dsts 'some?where,///room0///room1/door?action,room/door,door'
+ p.add_dsts 'some?where,room0/room1/door?action,room/door,door'
p.next_dst.should eql 'some?where'
p.dst_routed! d0
p.dst.should be d0
@@ -176,6 +176,22 @@ describe EvenDoors do
p.next_dst.should eql 'door'
end
#
+ it "wrong path should raise exeption" do
+ p = EvenDoors::Particle.new
+ lambda { p.set_dst! 'action', '/room' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! 'action', 'room/' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! '', 'room/' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! 'action', 'room//door' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! ' ' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! ' ', '' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! 'f f' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! '', ' d' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! '' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! '', '' }.should raise_error(EvenDoors::Exception)
+ lambda { p.set_dst! nil }.should raise_error(TypeError)
+ lambda { p.set_dst! 'action', nil }.should raise_error(NoMethodError)
+ end
+ #
it "routing: set_dst! and split_dst!" do
p = EvenDoors::Particle.new
d0 = EvenDoors::Door.new 'door0'
@@ -186,12 +202,6 @@ describe EvenDoors do
p.door.should eql 'door'
p.action.should eql 'action'
#
- p.set_dst! 'action', '//room////door'
- p.split_dst!
- p.room.should eql 'room'
- p.door.should eql 'door'
- p.action.should eql 'action'
- #
p.set_dst! 'action', 'room/door'
p.split_dst!
p.room.should eql 'room'
@@ -225,27 +235,6 @@ describe EvenDoors do
p.door.should eql nil
p.action.should eql 'action'
#
- p.set_dst! ''
- p.next_dst.should be_nil
- p.split_dst!
- p.room.should be_nil
- p.door.should be_nil
- p.action.should be_nil
- #
- p.set_dst! nil
- p.next_dst.should be_nil
- p.split_dst!
- p.room.should be_nil
- p.door.should be_nil
- p.action.should be_nil
- #
- p.set_dst! ' ', ' '
- p.next_dst.should be_nil
- p.split_dst!
- p.room.should be_nil
- p.door.should be_nil
- p.action.should be_nil
- #
end
#
it "routing: error!" do