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 flickering spec

ulfertsd7932a93c270
diff --git a/spec/models/query/results_spec.rb b/spec/models/query/results_spec.rb
index 1aee3c32355..8dc7daeac3f 100644
--- a/spec/models/query/results_spec.rb
+++ b/spec/models/query/results_spec.rb
@@ -446,8 +446,8 @@ describe ::Query::Results, type: :model, with_mail: false do
context 'when filtering by precedes and ordering by id' do
let(:query) do
- build :query,
- project: project1
+ build(:query,
+ project: project1)
end
before do
@@ -458,6 +458,12 @@ describe ::Query::Results, type: :model, with_mail: false do
query.add_filter('precedes', '=', [wp_p1[0].id.to_s])
query.sort_criteria = [['id', 'asc']]
+
+ # Reload is necessary as it fixes the lft/rgt columns of nested set
+ # that on some runs end up being the same as project2 (reason unknown),
+ # whereby the filter ends up with an invalid value since project2 gets loaded when
+ # executing project1.self_and_descendants where the wp_p1[0] is not in.
+ project1.reload
end
it 'returns the work packages preceding the filtered for work package' do