From 3e28baaa27cfa108cecaeb33533e54eea664295a Mon Sep 17 00:00:00 2001 From: Christophe Bliard Date: Tue, 13 Aug 2024 10:09:58 +0200 Subject: [PATCH] Fix test flakiness by forcing work packages order `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. --- spec/models/journable/with_historic_attributes_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/journable/with_historic_attributes_spec.rb b/spec/models/journable/with_historic_attributes_spec.rb index d5fd106b9b9c..24f6287831a7 100644 --- a/spec/models/journable/with_historic_attributes_spec.rb +++ b/spec/models/journable/with_historic_attributes_spec.rb @@ -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"] @@ -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"