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
Adapt update_ancestors feature spec expectations
Aaron Contreras6f2785a1c080
diff --git a/spec/features/work_packages/update_ancestors_spec.rb b/spec/features/work_packages/update_ancestors_spec.rbindex 2a3b872f99b..9b679ede53e 100644--- a/spec/features/work_packages/update_ancestors_spec.rb+++ b/spec/features/work_packages/update_ancestors_spec.rb@@ -102,12 +102,12 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite doendcontext 'when changing a child work and remaining work values', retry: 2 do- it 'updates the parent work, remaining work, and % complete values' do+ it "updates the derived parent work, remaining work, and % complete values" doexpect dowp_table.update_work_package_attributes(child, estimatedTime: child.estimated_hours + 1)parent.reloadend.to change(parent, :derived_estimated_hours).by(1)- .and change(parent, :done_ratio).to(35) # 7h at 50% and 3h at 0% => 35% complete for 10h+ .and change(parent, :derived_done_ratio).to(35) # 7h at 50% and 3h at 0% => 35% complete for 10hexpect dowp_table.update_work_package_attributes(child, remainingTime: child.remaining_hours + 2)parent.reload@@ -116,37 +116,37 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite doendcontext 'when changing a child % complete value' do- it 'updates the parent % complete value' do+ it 'updates the derived parent % complete value' doexpect dowp_table.update_work_package_attributes(child, percentageDone: 100)parent.reload- end.to change(parent, :done_ratio).to(67) # 6h at 100% and 3h at 0% => 67% complete for 9h+ end.to change(parent, :derived_done_ratio).to(67) # 6h at 100% and 3h at 0% => 67% complete for 9hendendcontext 'when setting a child status to closed' do- it 'considers child % complete to be 100% and updates the parent % complete value accordingly' do+ it 'considers child % complete to be 100% and updates the derived parent % complete value accordingly' doexpect dowp_table.update_work_package_attributes(child, status: 'Closed')parent.reload- end.to change(parent, :done_ratio).to(67) # 6h at 100% and 3h at 0% => 67% complete for 9h+ end.to change(parent, :derived_done_ratio).to(67) # 6h at 100% and 3h at 0% => 67% complete for 9hendendcontext 'when deleting a child' do- it 'updates the parent work, remaining work, and % complete values' do+ it 'updates the derived parent work, remaining work, and % complete values' docontext_menu = wp_table.open_context_menu_for(second_child)context_menu.choose_delete_and_confirm_deletionparent.reloadexpect(parent.derived_estimated_hours).to eq([parent, child].pluck(:estimated_hours).sum)expect(parent.derived_remaining_hours).to eq([parent, child].pluck(:remaining_hours).sum)- expect(parent.done_ratio).to eq(child.done_ratio)+ expect(parent.derived_done_ratio).to eq(child.done_ratio)endendcontext 'when adding a new child' do- it 'updates the parent work, remaining work, and % complete values' do+ it 'updates the derived parent work, remaining work, and % complete values' docontext_menu = wp_table.open_context_menu_for(parent)context_menu.choose(I18n.t('js.relation_buttons.add_new_child'))@@ -161,7 +161,7 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite doexpect(parent.derived_remaining_hours).to eq([parent, child, second_child, new_child].pluck(:remaining_hours).sum)# child + second child + new child => parent# 6h at 50% + 3h at 0% + 1h at 0% => 30% complete for 10h- expect(parent.done_ratio).to eq(30)+ expect(parent.derived_done_ratio).to eq(30)endend@@ -174,7 +174,7 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite doparent.reloadexpect(parent.derived_estimated_hours).to eq([parent, child].pluck(:estimated_hours).sum)expect(parent.derived_remaining_hours).to eq([parent, child].pluck(:remaining_hours).sum)- expect(parent.done_ratio).to eq(child.done_ratio)+ expect(parent.derived_done_ratio).to eq(child.done_ratio)context_menu = wp_table.open_context_menu_for(second_child)context_menu.choose(I18n.t('js.relation_buttons.hierarchy_indent'))@@ -185,7 +185,7 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite doexpect(parent.derived_remaining_hours).to eq([parent, child, second_child].pluck(:remaining_hours).sum)# child + second child => parent# 6h at 50% + 3h at 0% => 33% complete for 9h- expect(parent.done_ratio).to eq(33)+ expect(parent.derived_done_ratio).to eq(33)endendend