test/unit/test_embedded_document.rb in hashrocket-mongomapper-0.3.5 vs test/unit/test_embedded_document.rb in hashrocket-mongomapper-0.3.6
- old
+ new
@@ -168,9 +168,24 @@
should "not include descendant keys" do
lambda { Parent.new.other_child }.should raise_error
end
end
+
+ context "#inspect" do
+ setup do
+ @document = Class.new do
+ include MongoMapper::Document
+ key :animals
+ end
+ end
+
+ should "call inspect on the document's attributes instead of to_s" do
+ doc = @document.new
+ doc.animals = %w(dog cat)
+ doc.inspect.should include(%(animals: ["dog", "cat"]))
+ end
+ end
context "subclasses" do
should "default to nil" do
Child.subclasses.should be_nil
end