Sha256: 58c9784305d3838365e4ae4d37415776c0849a52e9ad71e2db00df9ae4f91498
Contents?: true
Size: 1.99 KB
Versions: 6
Compression:
Stored size: 1.99 KB
Contents
require 'spec_helper' describe 'read concern' do let(:subscriber) do EventSubscriber.new end let(:specified_read_concern) do { 'level' => 'local' } end let(:sent_read_concern) do subscriber.clear_events! collection.count_documents({}) subscriber.started_events.find { |c| c.command_name == 'aggregate' }.command[:readConcern] end shared_examples_for 'a read concern is specified' do it 'sends a read concern to the server' do expect(sent_read_concern).to eq(specified_read_concern) end end shared_examples_for 'no read concern is specified' do it 'does not send a read concern to the server' do expect(sent_read_concern).to be_nil end end context 'when the client has no read concern specified' do let(:client) do authorized_client.tap do |client| client.subscribe(Mongo::Monitoring::COMMAND, subscriber) end end context 'when the collection has no read concern specified' do let(:collection) do client[TEST_COLL] end it_behaves_like 'no read concern is specified' end context 'when the collection has a read concern specified' do let(:collection) do client[TEST_COLL].with(read_concern: specified_read_concern) end it_behaves_like 'a read concern is specified' end end context 'when the client has a read concern specified' do let(:client) do authorized_client.with(read_concern: specified_read_concern).tap do |client| client.subscribe(Mongo::Monitoring::COMMAND, subscriber) end end context 'when the collection has no read concern specified' do let(:collection) do client[TEST_COLL] end it_behaves_like 'a read concern is specified' end context 'when the collection has a read concern specified' do let(:collection) do client[TEST_COLL].with(read_concern: specified_read_concern) end it_behaves_like 'a read concern is specified' end end end
Version data entries
6 entries across 6 versions & 1 rubygems