Sha256: 9abe0097f133f1273ee4d6b04355d1a15413ef7d7ffa22fd06c1cbf810029ad3
Contents?: true
Size: 678 Bytes
Versions: 7
Compression:
Stored size: 678 Bytes
Contents
module Mongoid module Expectations def connection_class if defined?(Mongo::Server::ConnectionBase) Mongo::Server::ConnectionBase else # Pre-2.8 drivers Mongo::Server::Connection end end def expect_query(number) RSpec::Mocks.with_temporary_scope do if number > 0 expect_any_instance_of(connection_class).to receive(:command_started).exactly(number).times.and_call_original else expect_any_instance_of(connection_class).not_to receive(:command_started) end yield end end def expect_no_queries(&block) expect_query(0, &block) end end end
Version data entries
7 entries across 7 versions & 1 rubygems