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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Improve performance on `work_packages/update_ancestors_service_spec` (#13897)
Aaron Contreras664ee8ee8372
diff --git a/spec/services/work_packages/update_ancestors_service_spec.rb b/spec/services/work_packages/update_ancestors_service_spec.rbindex 94bd4e3a29e..54d219275f2 100644--- a/spec/services/work_packages/update_ancestors_service_spec.rb+++ b/spec/services/work_packages/update_ancestors_service_spec.rb@@ -29,12 +29,16 @@require 'spec_helper'RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do- let(:user) { create(:user) }+ shared_association_default(:author, factory_name: :user) { create(:user) }+ shared_association_default(:project_with_types) { create(:project_with_types) }+ shared_association_default(:priority) { create(:priority) }+ shared_association_default(:open_status, factory_name: :status) { create(:status) }+ shared_let(:closed_status) { create(:closed_status) }+ shared_let(:user) { create(:user) }+let(:estimated_hours) { [nil, nil, nil] }let(:done_ratios) { [0, 0, 0] }let(:statuses) { %i(open open open) }- let(:open_status) { create(:status) }- let(:closed_status) { create(:closed_status) }let(:aggregate_done_ratio) { 0.0 }let(:ignore_non_working_days) { [false, false, false] }@@ -47,7 +51,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'updated one work package - the parent' doexpect(subject.dependent_results.map(&:result))- .to match_array [parent]+ .to contain_exactly(parent)endit 'has the expected aggregate done ratio' do@@ -254,7 +258,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'returns the former ancestors in the dependent results' doexpect(subject.dependent_results.map(&:result))- .to match_array [parent, grandparent]+ .to contain_exactly(parent, grandparent)endit 'updates the done_ratio of the former parent' do@@ -309,7 +313,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'returns the new ancestors in the dependent results' doexpect(subject.dependent_results.map(&:result))- .to match_array [parent, grandparent]+ .to contain_exactly(parent, grandparent)endit 'updates the done_ratio of the new parent' do@@ -424,7 +428,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'returns both the former and new ancestors in the dependent results without duplicates' doexpect(subject.dependent_results.map(&:result))- .to match_array [new_parent, grandparent, old_parent]+ .to contain_exactly(new_parent, grandparent, old_parent)endit 'updates the done_ratio of the former parent' do@@ -498,7 +502,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'returns the former ancestors in the dependent results' doexpect(subject.dependent_results.map(&:result))- .to match_array [parent, grandparent, grandgrandparent]+ .to contain_exactly(parent, grandparent, grandgrandparent)endit 'sets the ignore_non_working_days property of the former ancestor chain to the value of the@@ -541,7 +545,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doit 'returns the former ancestors in the dependent results' doexpect(subject.dependent_results.map(&:result))- .to match_array [parent]+ .to contain_exactly(parent)endit 'sets the ignore_non_working_days property of the new ancestors' do