spec/mongo/collection_spec.rb in mongo-2.19.0 vs spec/mongo/collection_spec.rb in mongo-2.19.1
- old
+ new
@@ -649,25 +649,29 @@
let(:collection) do
described_class.new(database, :specs, :capped => true, :size => 4096, :max => 512)
end
let(:collstats) do
- database.read_command(:collstats => :specs).documents.first
+ collection.aggregate([ {'$collStats' => { 'storageStats' => {} }} ]).first
end
+ let(:storage_stats) do
+ collstats.fetch('storageStats', {})
+ end
+
before do
authorized_client[:specs].drop
collection.create
end
it 'returns true' do
expect(collection).to be_capped
end
it "applies the options" do
- expect(collstats["capped"]).to be true
- expect(collstats["max"]).to eq(512)
- expect(collstats["maxSize"]).to eq(4096)
+ expect(storage_stats["capped"]).to be true
+ expect(storage_stats["max"]).to eq(512)
+ expect(storage_stats["maxSize"]).to eq(4096)
end
end
context 'when the collection is not capped' do