Skip to content

Commit

Permalink
Fix test flakiness by forcing work packages order
Browse files Browse the repository at this point in the history
`WorkPackage.all` could return the work packages in any order, which can
occasionnally make the test fail as it expects the results in a certain
order.
  • Loading branch information
cbliard committed Aug 13, 2024
1 parent 046df33 commit 3e28baa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/models/journable/with_historic_attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
end

context "with active record relation of work packages" do
let(:work_packages) { WorkPackage.all }
let(:work_packages) { WorkPackage.order(subject: :asc).all }

it "provides access to the work-package attributes" do
expect(subject.map(&:subject)).to eq ["The current work package 1", "The current work package 2"]
Expand Down Expand Up @@ -246,7 +246,7 @@
end

context "with active record relation of work packages" do
let(:work_packages) { WorkPackage.all }
let(:work_packages) { WorkPackage.order(subject: :asc).all }

it "provides access to the work-package attributes at timestamps" do
expect(subject.first.attributes_by_timestamp["2022-01-01T00:00:00Z"].subject).to eq "The original work package 1"
Expand Down

0 comments on commit 3e28baa

Please sign in to comment.