test/unit/test_serialization.rb in mongo_mapper-0.7.0 vs test/unit/test_serialization.rb in mongo_mapper-0.7.1
- old
+ new
@@ -21,27 +21,27 @@
[:json].each do |format|
context format do
should "be reversable" do
serialized = @instance.send("to_#{format}")
- unserialized = @document.new.send("from_#{format}", serialized)
+ unserialized = @document.send("from_#{format}", serialized)
assert_equal @instance, unserialized
end
should "allow attribute only filtering" do
serialized = @instance.send("to_#{format}", :only => [ :age, :name ])
- unserialized = @document.new.send("from_#{format}", serialized)
+ unserialized = @document.send("from_#{format}", serialized)
assert_equal @instance.name, unserialized.name
assert_equal @instance.age, unserialized.age
assert ! unserialized.awesome
assert_nil unserialized.created_at
end
should "allow attribute except filtering" do
serialized = @instance.send("to_#{format}", :except => [ :age, :name ])
- unserialized = @document.new.send("from_#{format}", serialized)
+ unserialized = @document.send("from_#{format}", serialized)
assert_nil unserialized.name
assert_nil unserialized.age
assert_equal @instance.awesome, unserialized.awesome
end