Sha256: b870a50eca57101d6a609f779bf4953ab8da66c2f9304d903fbd063172efb55d
Contents?: true
Size: 756 Bytes
Versions: 25
Compression:
Stored size: 756 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 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) rv = nil 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 rv = yield end rv end def expect_no_queries(&block) expect_query(0, &block) end end end
Version data entries
25 entries across 25 versions & 2 rubygems