Sha256: 60bffa09e9876e96acbf3eaecce5bbb078cb66776986c76754ffaf1bd819fd72
Contents?: true
Size: 738 Bytes
Versions: 24
Compression:
Stored size: 738 Bytes
Contents
# frozen_string_literal: true 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
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
mongoid-8.0.1 | spec/support/expectations.rb |
mongoid-7.5.0 | spec/support/expectations.rb |
mongoid-7.4.1 | spec/support/expectations.rb |
mongoid-7.4.0 | spec/support/expectations.rb |