Skip to content

Commit

Permalink
RUBY-2254 sort by id when comparing collection contents (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis authored Jan 15, 2024
1 parent 1afa0a5 commit 199816f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion spec/mongo/collection_crud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ def generate
end

let(:updated) do
authorized_collection.find.to_a.last
authorized_collection.find.sort(_id: 1).to_a.last
end

it 'reports that a document was written' do
Expand Down
2 changes: 1 addition & 1 deletion spec/mongo/operation/insert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
end

it 'inserts the documents into the collection' do
expect(authorized_collection.find.to_a). to eq(documents)
expect(authorized_collection.find.sort(_id: 1).to_a). to eq(documents)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/runners/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
require 'runners/crud/verifier'

def collection_data(collection)
collection.find.to_a
collection.find.sort(_id: 1).to_a
end

def crud_execute_operations(spec, test, num_ops, event_subscriber, expect_error,
Expand Down
8 changes: 0 additions & 8 deletions spec/runners/crud/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ def setup_test(spec, client)
end
setup_fail_point(client)
end

def actual_collection_contents(client)
unless @spec.collection_name
raise ArgumentError, 'Spec does not specify a global collection'
end

client[@spec.collection_name, read_concern: {level: :majority}].find.to_a
end
end
end
end

0 comments on commit 199816f

Please sign in to comment.