summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/edoors/particle.rb1
-rw-r--r--spec/particle_spec.rb6
-rw-r--r--spec/spin_spec.rb10
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/edoors/particle.rb b/lib/edoors/particle.rb
index cf262bf..763c578 100644
--- a/lib/edoors/particle.rb
+++ b/lib/edoors/particle.rb
@@ -188,6 +188,7 @@ module Edoors
if d.is_a? Edoors::Iota
@dst = d
else
+ @dst = nil
_split_path! d
end
end
diff --git a/spec/particle_spec.rb b/spec/particle_spec.rb
index 206c37c..8d926ef 100644
--- a/spec/particle_spec.rb
+++ b/spec/particle_spec.rb
@@ -110,6 +110,12 @@ describe Edoors::Particle do
p.set_dst! 'action', d0
p.action.should eql 'action'
p.dst.should be d0
+ #
+ p.set_dst! 'action', '/world/room/door'
+ p.action.should eql 'action'
+ p.dst.should be nil
+ p.room.should eql '/world/room'
+ p.door.should eql 'door'
end
#
it "routing: add_dst and split_dst!" do
diff --git a/spec/spin_spec.rb b/spec/spin_spec.rb
index d72bcc6..9c2e2ea 100644
--- a/spec/spin_spec.rb
+++ b/spec/spin_spec.rb
@@ -92,6 +92,16 @@ describe Edoors::Spin do
spin.debug_garbage.should be true
end
#
+ it "search world" do
+ spin = Edoors::Spin.new 'dom0', :debug_routing=>true
+ r0 = Edoors::Room.new 'r0', spin
+ r1 = Edoors::Room.new 'r1', r0
+ r2 = Edoors::Room.new 'r2', r1
+ spin.search_world(r0.path).should be r0
+ spin.search_world(r1.path).should be r1
+ spin.search_world(r2.path).should be r2
+ end
+ #
it "spin->json->spin" do
spin = Edoors::Spin.new 'dom0', :debug_routing=>true
r0 = Edoors::Room.new 'r0', spin