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

Make code better thanks to Aaron's code review

Christophe Bliardff17c8ddf528
diff --git a/app/components/work_packages/progress/status_based/modal_body_component.html.erb b/app/components/work_packages/progress/status_based/modal_body_component.html.erb
index dcd76515a5e..d1a61701022 100644
--- a/app/components/work_packages/progress/status_based/modal_body_component.html.erb
+++ b/app/components/work_packages/progress/status_based/modal_body_component.html.erb
@@ -20,6 +20,7 @@
focused_field:,
touched_field_map:)) %>
<% else %>
+ <%# This condition branch to be removed in 15.0 with :percent_complete_edition feature flag removal %>
<%= render(WorkPackages::Pre144ProgressForm.new(f,
work_package:,
mode:,
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rb
index fe0b075bc9b..059376be18b 100644
--- a/app/contracts/work_packages/base_contract.rb
+++ b/app/contracts/work_packages/base_contract.rb
@@ -60,7 +60,7 @@ module WorkPackages
if OpenProject::FeatureDecisions.percent_complete_edition_active?
validate_percent_complete_matches_work_and_remaining_work
validate_percent_complete_is_unset_when_work_is_zero
- validate_percent_complete_is_set_when_work_and_remaining_work_are_not_set
+ validate_percent_complete_is_set_when_work_and_remaining_work_are_set
end
end
attribute :derived_done_ratio,
@@ -373,7 +373,7 @@ module WorkPackages
end
end
- def validate_percent_complete_is_set_when_work_and_remaining_work_are_not_set
+ def validate_percent_complete_is_set_when_work_and_remaining_work_are_set
if work_set_and_valid? && remaining_work_set_and_valid? && work != 0 && percent_complete_unset?
errors.add(:done_ratio, :must_be_set_when_work_and_remaining_work_are_set)
end
@@ -407,7 +407,7 @@ module WorkPackages
end
def work_set?
- model.estimated_hours.present?
+ work.present?
end
def work_set_and_valid?
@@ -415,7 +415,7 @@ module WorkPackages
end
def work_unset?
- model.estimated_hours.nil?
+ work.nil?
end
def remaining_work
@@ -423,7 +423,7 @@ module WorkPackages
end
def remaining_work_set?
- model.remaining_hours.present?
+ remaining_work.present?
end
def remaining_work_set_and_valid?
@@ -431,11 +431,11 @@ module WorkPackages
end
def remaining_work_unset?
- model.remaining_hours.nil?
+ remaining_work.nil?
end
def remaining_work_exceeds_work?
- work_set? && remaining_work_set? && model.remaining_hours > model.estimated_hours
+ work_set? && remaining_work_set? && remaining_work > work
end
def percent_complete
@@ -443,7 +443,7 @@ module WorkPackages
end
def percent_complete_set?
- model.done_ratio.present?
+ percent_complete.present?
end
def percent_complete_set_and_valid?
@@ -451,7 +451,7 @@ module WorkPackages
end
def percent_complete_unset?
- model.done_ratio.nil?
+ percent_complete.nil?
end
def validate_no_reopen_on_closed_version
diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb
index 4917a3a16c6..9c637bc96f2 100644
--- a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb
+++ b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb
@@ -73,6 +73,10 @@ class WorkPackages::SetAttributesService
work_package.estimated_hours_came_from_user?
end
+ def work_not_provided_by_user?
+ !work_came_from_user?
+ end
+
def remaining_work
work_package.remaining_hours
end
@@ -101,6 +105,10 @@ class WorkPackages::SetAttributesService
work_package.remaining_hours_came_from_user?
end
+ def remaining_work_not_provided_by_user?
+ !remaining_work_came_from_user?
+ end
+
def percent_complete
work_package.done_ratio
end
@@ -129,9 +137,17 @@ class WorkPackages::SetAttributesService
work_package.done_ratio_came_from_user?
end
+ def percent_complete_not_provided_by_user?
+ !percent_complete_came_from_user?
+ end
+
private
def round_progress_values
+ # The values are set only when rounding returns a different value. Doing
+ # otherwise would modify the values returned by `xxx_before_type_cast` and
+ # prevent the numericality validator from working when setting the field
+ # to a string value.
rounded = work&.round(2)
if rounded != work
self.work = rounded
diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb
index 26c20bcb363..155e0796c98 100644
--- a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb
+++ b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb
@@ -54,19 +54,19 @@ class WorkPackages::SetAttributesService
end
def derive_work?
- (remaining_work_changed? || percent_complete_changed?) && !work_came_from_user?
+ work_not_provided_by_user? && (remaining_work_changed? || percent_complete_changed?)
end
def derive_remaining_work?
- (work_changed? || percent_complete_changed?) && !remaining_work_came_from_user?
+ remaining_work_not_provided_by_user? && (work_changed? || percent_complete_changed?)
end
def derive_percent_complete?
- (work_changed? || remaining_work_changed?) && !percent_complete_came_from_user?
+ percent_complete_not_provided_by_user? && (work_changed? || remaining_work_changed?)
end
def update_work
- return if work_set? && !(remaining_work_came_from_user? && percent_complete_came_from_user?)
+ return if work_set_and_no_user_inputs_provided_for_both_remaining_work_and_percent_complete?
return if remaining_work_unset? && percent_complete_unset?
self.work = work_from_percent_complete_and_remaining_work
@@ -119,5 +119,9 @@ class WorkPackages::SetAttributesService
def attributes_from_user
@attributes_from_user ||= PROGRESS_ATTRIBUTES.filter { |attr| public_send(:"#{attr}_came_from_user?") }
end
+
+ def work_set_and_no_user_inputs_provided_for_both_remaining_work_and_percent_complete?
+ work_set? && (remaining_work_not_provided_by_user? || percent_complete_not_provided_by_user?)
+ end
end
end
diff --git a/spec/components/work_packages/progress/work_based/modal_body_component_pre_14_4_without_percent_complete_edition_spec.rb b/spec/components/work_packages/progress/work_based/modal_body_component_pre_14_4_without_percent_complete_edition_spec.rb
index e4ed732ee2a..22719695eae 100644
--- a/spec/components/work_packages/progress/work_based/modal_body_component_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/components/work_packages/progress/work_based/modal_body_component_pre_14_4_without_percent_complete_edition_spec.rb
@@ -32,7 +32,7 @@ require_relative "../shared_modal_examples"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
-RSpec.describe WorkPackages::Progress::WorkBased::ModalBodyComponent,
+RSpec.describe WorkPackages::Progress::WorkBased::ModalBodyComponent, "pre 14.4 without percent complete edition",
type: :component,
with_flag: { percent_complete_edition: false } do
include OpenProject::StaticRouting::UrlHelpers
@@ -55,7 +55,7 @@ RSpec.describe WorkPackages::Progress::WorkBased::ModalBodyComponent,
end
end
- context "when the work package has a percent complete value but and a work value but no remaining work set" do
+ context "when the work package has a percent complete value and a work value but no remaining work set" do
let(:work_package) do
create(:work_package) do |work_package|
work_package.estimated_hours = 55
diff --git a/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb b/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
index eab7e12f906..95d78a84c44 100644
--- a/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
@@ -32,7 +32,7 @@ require "contracts/shared/model_contract_shared_context"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
# Copied from commit 109b135b with a few changes for greater_than_or_equal_to validation
-RSpec.describe WorkPackages::BaseContract,
+RSpec.describe WorkPackages::BaseContract, "pre 14.4 without percent complete edition",
with_flag: { percent_complete_edition: false } do
include_context "ModelContract shared context"
diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rb
index 332cc604762..8e7246bc8ae 100644
--- a/spec/contracts/work_packages/base_contract_spec.rb
+++ b/spec/contracts/work_packages/base_contract_spec.rb
@@ -445,7 +445,7 @@ RSpec.describe WorkPackages::BaseContract,
end
describe "percent complete" do
- context "when inferred by status",
+ context "when in status-based progress calculation mode (inferred by status)",
with_settings: { work_package_done_ratio: "status" } do
it_behaves_like "invalid if changed", :done_ratio
end
@@ -458,7 +458,6 @@ RSpec.describe WorkPackages::BaseContract,
work_package.done_ratio = done_ratio
end
- # TODO: get better error message
context "when less than 0" do
let(:estimated_hours) { nil }
let(:remaining_hours) { nil }
@@ -467,8 +466,7 @@ RSpec.describe WorkPackages::BaseContract,
it_behaves_like "contract is invalid", done_ratio: :inclusion
end
- # TODO: get better error message
- context "when less more than 100" do
+ context "when more than 100" do
let(:estimated_hours) { nil }
let(:remaining_hours) { nil }
let(:done_ratio) { 101 }
diff --git a/spec/controllers/work_packages/progress_controller_pre_14_4_without_percent_complete_edition_spec.rb b/spec/controllers/work_packages/progress_controller_pre_14_4_without_percent_complete_edition_spec.rb
index f1ed97af742..b8645014514 100644
--- a/spec/controllers/work_packages/progress_controller_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/controllers/work_packages/progress_controller_pre_14_4_without_percent_complete_edition_spec.rb
@@ -33,7 +33,7 @@ require "spec_helper"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
# Copied from commit 109b135b]
-RSpec.describe WorkPackages::ProgressController,
+RSpec.describe WorkPackages::ProgressController, "pre 14.4 without percent complete edition",
with_flag: { percent_complete_edition: false } do
shared_let(:user) { create(:admin) }
shared_let(:work_package) { create(:work_package) }
diff --git a/spec/features/work_packages/progress_modal_pre_14_4_without_percent_complete_edition_spec.rb b/spec/features/work_packages/progress_modal_pre_14_4_without_percent_complete_edition_spec.rb
index 2fe287323c4..f2a10392d6b 100644
--- a/spec/features/work_packages/progress_modal_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/features/work_packages/progress_modal_pre_14_4_without_percent_complete_edition_spec.rb
@@ -33,7 +33,7 @@ require "spec_helper"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
# Copied from commit 109b135b
-RSpec.describe "Progress modal", :js, :with_cuprite,
+RSpec.describe "Progress modal", "pre 14.4 without percent complete edition", :js, :with_cuprite, # rubocop:disable RSpec/SortMetadata
with_flag: { percent_complete_edition: false } do
shared_let(:user) { create(:admin) }
shared_let(:role) { create(:project_role) }
diff --git a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
index af6ba47206d..213bc3d8fb9 100644
--- a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
@@ -30,7 +30,7 @@ require "spec_helper"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
-RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema,
+RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema, "pre 14.4 without percent complete edition",
with_flag: { percent_complete_edition: false } do
let(:project) { build_stubbed(:project) }
let(:type) { build_stubbed(:type) }
diff --git a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
index ee8689d7916..56a949c5785 100644
--- a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_pre_14_4_without_percent_complete_edition_spec.rb
@@ -30,7 +30,7 @@ require "spec_helper"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
-RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema,
+RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema, "pre 14.4 without percent complete edition",
with_flag: { percent_complete_edition: false } do
let(:project) { build(:project) }
let(:type) { build(:type) }
diff --git a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_pre_14_4_without_percent_complete_edition_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_pre_14_4_without_percent_complete_edition_spec.rb
index e4158314c03..5ed76ecff2c 100644
--- a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_pre_14_4_without_percent_complete_edition_spec.rb
@@ -30,7 +30,7 @@ require "spec_helper"
# This file can be safely deleted once the feature flag :percent_complete_edition
# is removed, which should happen for OpenProject 15.0 release.
-RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter,
+RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter, "pre 14.4 without percent complete edition",
with_flag: { percent_complete_edition: false } do
include API::V3::Utilities::PathHelper
diff --git a/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb b/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb
index a537b127931..6d695996233 100644
--- a/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb
+++ b/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = 10.0
work_package.remaining_hours = 5.0
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is unset" do
@@ -127,7 +127,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = nil
work_package.remaining_hours = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when another status with another % complete value is set" do
@@ -167,7 +167,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
before do
work_package.status = status_50_pct_complete
work_package.done_ratio = work_package.status.default_done_ratio
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when another status with another % complete value is set" do
diff --git a/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb b/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb
index 9959910b3ef..88eebf1b8ee 100644
--- a/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb
+++ b/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = 10.0
work_package.remaining_hours = 3.0
work_package.done_ratio = 70
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is unset" do
@@ -320,7 +320,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = 10
work_package.remaining_hours = nil
work_package.done_ratio = 30
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is changed" do
@@ -362,7 +362,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = nil
work_package.remaining_hours = 2.0
work_package.done_ratio = 50
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when remaining work is changed" do
@@ -380,7 +380,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
before do
work_package.done_ratio = 0
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
include_examples "update progress values",
@@ -409,7 +409,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = 10
work_package.remaining_hours = nil
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is changed" do
@@ -453,7 +453,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = nil
work_package.remaining_hours = 6.0
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -505,7 +505,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = 0
work_package.remaining_hours = 0
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -522,7 +522,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = 60
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -592,7 +592,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
diff --git a/spec/services/work_packages/set_attributes_service_pre_14_4_without_percent_complete_edition_spec.rb b/spec/services/work_packages/set_attributes_service_pre_14_4_without_percent_complete_edition_spec.rb
index 677168a8e1d..e0b9671a0fb 100644
--- a/spec/services/work_packages/set_attributes_service_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/services/work_packages/set_attributes_service_pre_14_4_without_percent_complete_edition_spec.rb
@@ -123,7 +123,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = 10.0
work_package.remaining_hours = 5.0
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is unset" do
@@ -170,7 +170,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = nil
work_package.remaining_hours = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when another status with another % complete value is set" do
@@ -216,7 +216,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
before do
work_package.status = status_50_pct_complete
work_package.done_ratio = work_package.status.default_done_ratio
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when another status with another % complete value is set" do
@@ -235,7 +235,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = 10.0
work_package.remaining_hours = 3.0
work_package.done_ratio = 70
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is unset" do
@@ -380,7 +380,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = 10
work_package.remaining_hours = nil
work_package.done_ratio = 30
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is changed" do
@@ -414,7 +414,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = nil
work_package.remaining_hours = 2.0
work_package.done_ratio = 50
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when remaining work is changed" do
@@ -432,7 +432,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
before do
work_package.done_ratio = 0
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
it_behaves_like "service call",
@@ -453,7 +453,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = 10
work_package.remaining_hours = nil
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is changed" do
@@ -488,7 +488,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = nil
work_package.remaining_hours = 6.0
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -532,7 +532,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = 60
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -596,7 +596,7 @@ RSpec.describe WorkPackages::SetAttributesService, "pre 14.4 without percent com
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rb
index 69f4fb3b8aa..ec7e65cce61 100644
--- a/spec/services/work_packages/set_attributes_service_spec.rb
+++ b/spec/services/work_packages/set_attributes_service_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe WorkPackages::SetAttributesService,
let(:work_package) do
wp = build_stubbed(:work_package, project:, status: status_0_pct_complete)
wp.type = initial_type
- wp.send(:clear_changes_information)
+ wp.clear_changes_information
wp
end
@@ -152,7 +152,7 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = 10.0
work_package.remaining_hours = 5.0
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is changed" do
@@ -178,7 +178,7 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.done_ratio = work_package.status.default_done_ratio
work_package.estimated_hours = nil
work_package.remaining_hours = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when another status with another % complete value is set" do
@@ -206,7 +206,7 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.estimated_hours = 10.0
work_package.remaining_hours = 3.0
work_package.done_ratio = 70
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when remaining work is unset" do
@@ -255,7 +255,7 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = 60
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -272,7 +272,7 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.estimated_hours = nil
work_package.remaining_hours = nil
work_package.done_ratio = nil
- work_package.send(:clear_changes_information)
+ work_package.clear_changes_information
end
context "when work is set" do
@@ -1796,7 +1796,7 @@ RSpec.describe WorkPackages::SetAttributesService,
start_date: Time.zone.today,
due_date: Time.zone.today + 5.days)
wp.type = build_stubbed(:type)
- wp.send(:clear_changes_information)
+ wp.clear_changes_information
allow(wp)
.to receive(:soonest_start)