spec/public/to_json_spec.rb in dm-serializer-0.9.8 vs spec/public/to_json_spec.rb in dm-serializer-0.9.9
- old
+ new
@@ -27,48 +27,10 @@
end
end.new
end
it_should_behave_like "A serialization method"
-
- it "should serialize an array of collections" do
- deserialized_collection = JSON.parse([@collection].to_json).first
- betsy = deserialized_collection.first
- berta = deserialized_collection.last
-
- betsy["id"].should == 1
- betsy["composite"].should == 2
- betsy["name"].should == "Betsy"
- betsy["breed"].should == "Jersey"
-
- berta["id"].should == 10
- berta["composite"].should == 20
- berta["name"].should == "Berta"
- berta["breed"].should == "Guernsey"
- end
-
- it "should serialize an array of extended objects" do
- deserialized_collection = JSON.parse(@collection.to_a.to_json)
- betsy = deserialized_collection.first
- berta = deserialized_collection.last
-
- betsy["id"].should == 1
- betsy["composite"].should == 2
- betsy["name"].should == "Betsy"
- betsy["breed"].should == "Jersey"
-
- berta["id"].should == 10
- berta["composite"].should == 20
- berta["name"].should == "Berta"
- berta["breed"].should == "Guernsey"
- end
-
- it "handles extra properties" do
- deserialized_hash = JSON.parse(Cow.new(:id => 1, :name => "Harry", :breed => "Angus").to_json)
-
- deserialized_hash["extra"].should == "Extra"
- deserialized_hash["another"].should == 42
- end
+ it_should_behave_like 'A serialization method that also serializes core classes'
it "handles options given to a collection properly" do
deserialized_collection = JSON.parse(@collection.to_json(:only => [:composite]))
betsy = deserialized_collection.first
berta = deserialized_collection.last