Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix test flakiness by forcing work packages order

Christophe Bliard3e28baaa27cf
diff --git a/spec/models/journable/with_historic_attributes_spec.rb b/spec/models/journable/with_historic_attributes_spec.rb
index d5fd106b9b9..24f6287831a 100644
--- a/spec/models/journable/with_historic_attributes_spec.rb
+++ b/spec/models/journable/with_historic_attributes_spec.rb
@@ -149,7 +149,7 @@ RSpec.describe Journable::WithHistoricAttributes,
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 @@ RSpec.describe Journable::WithHistoricAttributes,
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"