test/functional/test_caching.rb in mongo_mapper-0.8.6 vs test/functional/test_caching.rb in mongo_mapper-0.9.0
- old
+ new
@@ -6,18 +6,19 @@
@klass = Class.new do
extend MongoMapper::Plugins
plugin MongoMapper::Plugins::Caching
end
@klass.stubs(:name).returns('Post')
+ @klass.any_instance.stubs(:persisted?).returns(true)
@klass.any_instance.stubs(:[]).returns(nil)
@klass.any_instance.stubs(:[]=).returns(nil)
end
context "new" do
setup do
@doc = @klass.new
- @doc.stubs(:new?).returns(true)
+ @doc.stubs(:persisted?).returns(false)
end
should "be class/new" do
@doc.cache_key.should == 'Post/new'
end
@@ -33,10 +34,10 @@
context "not new" do
setup do
@object_id = BSON::ObjectId.new
@doc = @klass.new
- @doc.stubs(:new?).returns(false)
+ @doc.stubs(:persisted).returns(true)
@doc.stubs(:id).returns(@object_id)
end
context "with updated_at" do
setup do
\ No newline at end of file