test/functional/test_document.rb in jmonteiro-mongo_mapper-0.1.6 vs test/functional/test_document.rb in jmonteiro-mongo_mapper-0.1.7
- old
+ new
@@ -391,11 +391,11 @@
@document.find_by_id(@doc1._id).should == @doc1
@document.find_by_id(@doc2._id).should == @doc2
end
should "return nil if document not found" do
- @document.find_by_id(1234).should be(nil)
+ @document.find_by_id(1234).should be_nil
end
end
context "ClassMethods#delete (single document)" do
setup do
@@ -1101,9 +1101,14 @@
@instance.bars.first.name.should == '1'
end
should "return self" do
@instance.reload.object_id.should == @instance.object_id
+ end
+
+ should "raise DocumentNotFound if not found" do
+ @instance.destroy
+ assert_raises(MongoMapper::DocumentNotFound) { @instance.reload }
end
end
context "Loading a document from the database with keys that are not defined" do
setup do