test/test_mongoo.rb in mongoo-0.4.7 vs test/test_mongoo.rb in mongoo-0.4.8
- old
+ new
@@ -411,7 +411,21 @@
p.name = "Ben Myles"
p.update!(find_and_modify: true)
assert_equal "Ben Myles", p.name
assert_equal ["skydiving", "coding", "swimming"], p.interests
end
+
+ should "be just one _id key after insert" do
+ p = Person.new(name: "Ben")
+ p.insert!
+ assert p.mongohash.has_key?('_id')
+ assert !p.mongohash.has_key?(:_id)
+ p.name = "Ben Myles"
+ p.update!
+ assert p.mongohash.has_key?('_id')
+ assert !p.mongohash.has_key?(:_id)
+ p = Person.find_one(p.id)
+ assert p.mongohash.has_key?('_id')
+ assert !p.mongohash.has_key?(:_id)
+ end
end