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 duration calculation in work package factory

Christophe Bliard76a9a067d895
diff --git a/spec/factories/work_package_factory.rb b/spec/factories/work_package_factory.rb
index 3aefb0b94c2..b76dab88e13 100644
--- a/spec/factories/work_package_factory.rb
+++ b/spec/factories/work_package_factory.rb
@@ -40,7 +40,7 @@ FactoryBot.define do
author factory: :user
created_at { Time.zone.now }
updated_at { Time.zone.now }
- duration { WorkPackages::Shared::AllDays.new.duration(start_date&.to_date, due_date&.to_date) }
+ duration { WorkPackages::Shared::Days.for(self).duration(start_date&.to_date, due_date&.to_date) }
callback(:after_build) do |work_package, evaluator|
work_package.type = work_package.project.types.first unless work_package.type
diff --git a/spec/services/work_packages/set_schedule_service_working_days_spec.rb b/spec/services/work_packages/set_schedule_service_working_days_spec.rb
index 53f1d00e844..3a72726c966 100644
--- a/spec/services/work_packages/set_schedule_service_working_days_spec.rb
+++ b/spec/services/work_packages/set_schedule_service_working_days_spec.rb
@@ -505,9 +505,9 @@ describe WorkPackages::SetScheduleService, 'working days', with_flag: { work_pac
context 'with follower having both start and due dates before predecessor due date' do
let_schedule(<<~CHART, ignore_non_working_days: false)
- days | mtwtfssMTWTFSS |
- work_package | XX |
- follower | XXXX |
+ days | mtwtfssMTWTFSS |
+ work_package | XX |
+ follower | X..XXX |
CHART
before do