Skip to content

Commit abe3837

Browse files
authored
RUBY-2814 added a test for #collections authorized_collections: true (#2388)
1 parent a134651 commit abe3837

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

spec/mongo/database_spec.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@
591591
end
592592
end
593593

594-
context 'when authorized_collections are provided' do
594+
context 'when authorized_collections are provided as false' do
595595
let(:options) do
596596
{ authorized_collections: false }
597597
end
@@ -612,6 +612,27 @@
612612
end
613613
end
614614

615+
context 'when authorized_collections are provided as true' do
616+
let(:options) do
617+
{ authorized_collections: true }
618+
end
619+
620+
let!(:result) do
621+
database.collections(options)
622+
end
623+
624+
let(:events) do
625+
subscriber.command_started_events('listCollections')
626+
end
627+
628+
it 'authorized_collections not passed to server because false' do
629+
expect(events.length).to eq(1)
630+
command = events.first.command
631+
expect(command['nameOnly']).to eq(true)
632+
expect(command['authorizedCollections']).to eq(true)
633+
end
634+
end
635+
615636
context 'when no options are provided' do
616637
let!(:result) do
617638
database.collections

0 commit comments

Comments
 (0)