Skip to content

Commit 199816f

Browse files
authored
RUBY-2254 sort by id when comparing collection contents (#2823)
1 parent 1afa0a5 commit 199816f

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

spec/mongo/collection_crud_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,7 @@ def generate
24912491
end
24922492

24932493
let(:updated) do
2494-
authorized_collection.find.to_a.last
2494+
authorized_collection.find.sort(_id: 1).to_a.last
24952495
end
24962496

24972497
it 'reports that a document was written' do

spec/mongo/operation/insert_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
end
178178

179179
it 'inserts the documents into the collection' do
180-
expect(authorized_collection.find.to_a). to eq(documents)
180+
expect(authorized_collection.find.sort(_id: 1).to_a). to eq(documents)
181181
end
182182
end
183183

spec/runners/crud.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
require 'runners/crud/verifier'
2727

2828
def collection_data(collection)
29-
collection.find.to_a
29+
collection.find.sort(_id: 1).to_a
3030
end
3131

3232
def crud_execute_operations(spec, test, num_ops, event_subscriber, expect_error,

spec/runners/crud/test.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,6 @@ def setup_test(spec, client)
110110
end
111111
setup_fail_point(client)
112112
end
113-
114-
def actual_collection_contents(client)
115-
unless @spec.collection_name
116-
raise ArgumentError, 'Spec does not specify a global collection'
117-
end
118-
119-
client[@spec.collection_name, read_concern: {level: :majority}].find.to_a
120-
end
121113
end
122114
end
123115
end

0 commit comments

Comments
 (0)