spec/support/helpers/document_finder_stubs.rb in mongomodel-0.4.9 vs spec/support/helpers/document_finder_stubs.rb in mongomodel-0.5.0
- old
+ new
@@ -2,17 +2,17 @@
module DocumentFinderStubs
include RSpec::Mocks::ExampleMethods
def stub_find(result)
- find_result = mock('find result', :to_a => result.map { |doc| doc.to_mongo }, :count => result.size).as_null_object
- collection.stub!(:find).and_return(find_result)
+ find_result = double('find result', :to_a => result.map { |doc| doc.to_mongo }, :count => result.size).as_null_object
+ collection.stub(:find).and_return(find_result)
end
def should_find(expected={}, result=[])
selector, options = MongoModel::MongoOptions.new(self, expected).to_a
- find_result = mock('find result', :to_a => result.map { |doc| doc.to_mongo }).as_null_object
+ find_result = double('find result', :to_a => result.map { |doc| doc.to_mongo }).as_null_object
collection.should_receive(:find).once.with(selector, options).and_return(find_result)
yield if block_given?
end
def should_not_find
@@ -20,21 +20,21 @@
yield if block_given?
end
def should_count(expected={}, result=[])
selector, options = MongoModel::MongoOptions.new(self, expected).to_a
- find_result = mock('find result', :count => result).as_null_object
+ find_result = double('find result', :count => result).as_null_object
collection.should_receive(:find).once.with(selector, options).and_return(find_result)
yield if block_given?
end
def should_not_count
collection.should_not_receive(:find)
yield if block_given?
end
def stub_delete
- collection.stub!(:remove)
+ collection.stub(:remove)
end
def should_delete(conditions={})
selector, options = MongoModel::MongoOptions.new(self, :conditions => conditions).to_a
collection.should_receive(:remove).once.with(selector, options)