diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 15:06:45 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 15:06:45 +0200 |
commit | f72393c031018d224318fb4aeff16b6e6c330327 (patch) | |
tree | a1790ac6bc37bdef3dba2d2774993c144a84df53 /spec | |
parent | 86a09a1f49744002a81702d16600171fc8407552 (diff) | |
download | edoors-ruby-f72393c031018d224318fb4aeff16b6e6c330327.zip edoors-ruby-f72393c031018d224318fb4aeff16b6e6c330327.tar.gz |
specs: update to follow new dsts policy
Diffstat (limited to 'spec')
-rw-r--r-- | spec/evendoors_spec.rb | 45 |
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 |