Skip to content

Commit e104992

Browse files
committed
Add Mongo::Client#collections spec
1 parent d047e99 commit e104992

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

spec/mongo/client_spec.rb

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

0 commit comments

Comments
 (0)