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 expectations

Christophe Bliardfe0e563d3b14
diff --git a/spec/features/work_packages/update_ancestors_spec.rb b/spec/features/work_packages/update_ancestors_spec.rb
index 37e2b1d6627..67427a0d3ae 100644
--- a/spec/features/work_packages/update_ancestors_spec.rb
+++ b/spec/features/work_packages/update_ancestors_spec.rb
@@ -106,13 +106,16 @@ RSpec.describe "Update ancestors", :js, :with_cuprite do
expect do
wp_table.update_work_package_attributes(child, estimatedTime: child.estimated_hours + 1)
parent.reload
- end.to change(parent, :derived_estimated_hours).by(1)
- .and change(parent, :derived_done_ratio).to(42) # 12h total work and 7h total remaining work => 42% complete
+ child.reload
+ # binding.irb
+ end.to change(child, :remaining_hours).by(1) # remaining work increased as a side effect of increasing work
+ .and change(parent, :derived_estimated_hours).by(1)
+ .and change(parent, :derived_done_ratio).to(33) # 12h total work and 8h total remaining work => 33% complete
expect do
wp_table.update_work_package_attributes(child, remainingTime: child.remaining_hours + 2)
parent.reload
end.to change(parent, :derived_remaining_hours).by(2)
- .and change(parent, :derived_done_ratio).to(25) # 12h total work and 9h total remaining work => 25% complete
+ .and change(parent, :derived_done_ratio).to(17) # 12h total work and 10h total remaining work => 17% complete
end
end