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
allow rubocop not to fail
Ivan Kuchin6be3ffce0dee
diff --git a/app/models/work_package.rb b/app/models/work_package.rbindex 4de4b0b0024..f4d2c99c043 100644--- a/app/models/work_package.rb+++ b/app/models/work_package.rb@@ -335,7 +335,7 @@ class WorkPackage < ApplicationRecordenddef duration_in_hours- duration ? duration * 24 : nil+ duration * 24 if durationenddef project_phasediff --git a/spec/models/work_package_spec.rb b/spec/models/work_package_spec.rbindex f5f0abc2069..4221dd860a8 100644--- a/spec/models/work_package_spec.rb+++ b/spec/models/work_package_spec.rb@@ -708,7 +708,7 @@ RSpec.describe WorkPackage dodescribe "#duration" docontext "when not setting a value" doit "is nil" do- expect(work_package.duration).to be_nil+ expect(work_package).to have_attributes(duration: nil)endend@@ -718,7 +718,25 @@ RSpec.describe WorkPackage doendit "is the value" do- expect(work_package.duration).to eq(5)+ expect(work_package).to have_attributes(duration: 5)+ end+ end+ end++ describe "#duration_in_hours" do+ context "when not setting duration" do+ it "is nil" do+ expect(work_package).to have_attributes(duration_in_hours: nil)+ end+ end++ context "when setting duration value" do+ before do+ work_package.duration = 5+ end++ it "is the value" do+ expect(work_package).to have_attributes(duration_in_hours: 120)endendend