spec/mongo/operation/delete/op_msg_spec.rb in mongo-2.17.4 vs spec/mongo/operation/delete/op_msg_spec.rb in mongo-2.18.0.beta1
- old
+ new
@@ -161,12 +161,15 @@
global_args.dup.tap do |args|
args.delete(:lsid)
end
end
- before do
- session.instance_variable_set(:@options, { implicit: true })
+ let(:session) do
+ Mongo::Session.new(nil, authorized_client, implicit: true).tap do |session|
+ allow(session).to receive(:session_id).and_return(42)
+ session.should be_implicit
+ end
end
it 'creates the correct OP_MSG message' do
RSpec::Mocks.with_temporary_scope do
expect(connection.features).to receive(:sessions_enabled?).and_return(false)
@@ -186,12 +189,14 @@
end
context 'when the session is implicit' do
let(:session) do
- # Use client#get_session so the session is implicit
- authorized_client.send(:get_session)
+ Mongo::Session.new(nil, authorized_client, implicit: true).tap do |session|
+ allow(session).to receive(:session_id).and_return(42)
+ session.should be_implicit
+ end
end
context 'when the topology is replica set or sharded' do
min_server_fcv '3.6'
require_topology :replica_set, :sharded
@@ -232,9 +237,13 @@
min_server_fcv '3.6'
require_topology :replica_set, :sharded
let(:session) do
authorized_client.start_session
+ end
+
+ before do
+ session.should_not be_implicit
end
let(:expected_global_args) do
global_args.dup.tap do |args|
args.delete(:lsid)