Skip to content

Commit 32ba84e

Browse files
committed
Add Mongo::Client#collections spec
Use authorized_client
1 parent d047e99 commit 32ba84e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/mongo/client_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,4 +742,24 @@
742742
expect(client.dup.options).to be_a(Mongo::Options::Redacted)
743743
end
744744
end
745+
746+
describe '#collections' do
747+
748+
before do
749+
authorized_client.database[:users].create
750+
end
751+
752+
after do
753+
authorized_client.database[:users].drop
754+
end
755+
756+
let(:collection) do
757+
Mongo::Collection.new(authorized_client.database, 'users')
758+
end
759+
760+
it 'refers the current database collections' do
761+
expect(authorized_client.collections).to include(collection)
762+
expect(authorized_client.collections).to all(be_a(Mongo::Collection))
763+
end
764+
end
745765
end

0 commit comments

Comments
 (0)