summaryrefslogtreecommitdiffstats
path: root/spec/room_spec.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-10 22:53:23 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-10 22:53:23 +0200
commit4a0e3178b90450d2ee65e04b74f7f3f8f0e2830c (patch)
treebe5ae01e4a04e83206e4c6c18d1c8f88e5a5acd3 /spec/room_spec.rb
parent2fd2f49b684ba22dea0ed9313b3ce257b4b82488 (diff)
downloadedoors-ruby-4a0e3178b90450d2ee65e04b74f7f3f8f0e2830c.zip
edoors-ruby-4a0e3178b90450d2ee65e04b74f7f3f8f0e2830c.tar.gz
specs: Room->json->Room
Diffstat (limited to 'spec/room_spec.rb')
-rw-r--r--spec/room_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/room_spec.rb b/spec/room_spec.rb
index fede784..26f5023 100644
--- a/spec/room_spec.rb
+++ b/spec/room_spec.rb
@@ -268,6 +268,23 @@ describe EvenDoors::Room do
p.dst.should be door1
end
#
+ it "room->json->room" do
+ r0 = EvenDoors::Room.new 'r0'
+ r1 = EvenDoors::Room.new 'r1', r0
+ r2 = EvenDoors::Room.new 'r2', r1
+ r3 = EvenDoors::Room.new 'r3', r1
+ r4 = EvenDoors::Room.new 'r4', r3
+ d0 = EvenDoors::Door.new 'd0', r1
+ d1 = EvenDoors::Door.new 'd1', r1
+ d2 = EvenDoors::Door.new 'd2', r2
+ r1.add_link EvenDoors::Link.new('d0', 'd1', 'fields', 'f0,f1', 'v0v1')
+ r1.add_link EvenDoors::Link.new('d0', 'd2')
+ r1.add_link EvenDoors::Link.new('d1', 'd0')
+ r2.add_link EvenDoors::Link.new('d2', 'd1', 'fies', 'f5,f1', 'v9v1')
+ rx = EvenDoors::Room.json_create( JSON.load( JSON.generate(r0) ) )
+ JSON.generate(r0).should eql JSON.generate(rx)
+ end#
+ #
end
#
# EOF