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

Update wording to match the one used in user messages

Christophe Bliardb1dec3931360
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rb
index dfdf56eba60..87c77f50031 100644
--- a/app/contracts/work_packages/base_contract.rb
+++ b/app/contracts/work_packages/base_contract.rb
@@ -59,7 +59,7 @@ module WorkPackages
} do
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_empty_when_work_is_zero
validate_percent_complete_is_set_when_work_and_remaining_work_are_set
end
end
@@ -80,7 +80,7 @@ module WorkPackages
attribute :remaining_hours do
validate_remaining_work_is_lower_than_work
if OpenProject::FeatureDecisions.percent_complete_edition_active?
- validate_remaining_work_is_zero_or_unset_when_percent_complete_is_100p
+ validate_remaining_work_is_zero_or_empty_when_percent_complete_is_100p
validate_remaining_work_is_set_when_work_and_percent_complete_are_set
else
# to be removed in 15.0 with :percent_complete_edition feature flag removal
@@ -363,25 +363,25 @@ module WorkPackages
end
def validate_work_is_set_when_remaining_work_and_percent_complete_are_set
- if remaining_work_set_and_valid? && percent_complete_set_and_valid? && work_unset? && percent_complete != 100
+ if remaining_work_set_and_valid? && percent_complete_set_and_valid? && work_empty? && percent_complete != 100
errors.add(:estimated_hours, :must_be_set_when_remaining_work_and_percent_complete_are_set)
end
end
- def validate_remaining_work_is_zero_or_unset_when_percent_complete_is_100p
+ def validate_remaining_work_is_zero_or_empty_when_percent_complete_is_100p
return unless percent_complete == 100
if work_set_and_valid? && remaining_work != 0
errors.add(:remaining_hours, :must_be_set_to_zero_hours_when_work_is_set_and_percent_complete_is_100p)
- elsif work_unset? && remaining_work_set?
- errors.add(:remaining_hours, :must_be_unset_when_work_is_unset_and_percent_complete_is_100p)
+ elsif work_empty? && remaining_work_set?
+ errors.add(:remaining_hours, :must_be_empty_when_work_is_empty_and_percent_complete_is_100p)
end
end
def validate_remaining_work_is_set_when_work_and_percent_complete_are_set
return if percent_complete == 100
- if work_set_and_valid? && percent_complete_set_and_valid? && remaining_work_unset?
+ if work_set_and_valid? && percent_complete_set_and_valid? && remaining_work_empty?
errors.add(:remaining_hours, :must_be_set_when_work_and_percent_complete_are_set)
end
end
@@ -389,7 +389,7 @@ module WorkPackages
def validate_percent_complete_is_set_when_work_and_remaining_work_are_set
return if remaining_work_exceeds_work? # avoid too many error messages at the same time
- if work_set_and_valid? && remaining_work_set_and_valid? && work != 0 && percent_complete_unset?
+ if work_set_and_valid? && remaining_work_set_and_valid? && work != 0 && percent_complete_empty?
errors.add(:done_ratio, :must_be_set_when_work_and_remaining_work_are_set)
end
end
@@ -402,7 +402,7 @@ module WorkPackages
end
end
- def validate_percent_complete_is_unset_when_work_is_zero
+ def validate_percent_complete_is_empty_when_work_is_zero
return if WorkPackage.status_based_mode?
if work == 0 && percent_complete_set?
@@ -422,7 +422,7 @@ module WorkPackages
work_set? && work >= 0
end
- def work_unset?
+ def work_empty?
work.nil?
end
@@ -438,7 +438,7 @@ module WorkPackages
remaining_work_set? && remaining_work >= 0
end
- def remaining_work_unset?
+ def remaining_work_empty?
remaining_work.nil?
end
@@ -449,7 +449,7 @@ module WorkPackages
end
def remaining_work_exceeds_work?
- # if % complete is 100%, then remaining work should be 0h or unset, so no
+ # if % complete is 100%, then remaining work should be 0h or empty, so no
# need to display an error for remaining work exceeding work
return false if percent_complete == 100
@@ -468,13 +468,13 @@ module WorkPackages
percent_complete_set? && percent_complete.between?(0, 100)
end
- def percent_complete_unset?
+ def percent_complete_empty?
percent_complete.nil?
end
def percent_complete_derivation_unapplicable?
WorkPackage.status_based_mode? || # only applicable in work-based mode
- work_unset? || remaining_work_unset? || percent_complete_unset? || # only applicable if all 3 values are set
+ work_empty? || remaining_work_empty? || percent_complete_empty? || # only applicable if all 3 values are set
work == 0 || percent_complete == 100 || # only applicable if not in special cases leading to divisions by zero
invalid_work_or_remaining_work_values? # only applicable if work and remaining work values are valid
end
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 7e87d9b36fb..229d7ea0518 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
@@ -55,11 +55,11 @@ class WorkPackages::SetAttributesService
work.present?
end
- def work_unset?
+ def work_empty?
work.nil?
end
- def work_was_unset?
+ def work_was_empty?
work_package.estimated_hours_was.nil?
end
@@ -87,11 +87,11 @@ class WorkPackages::SetAttributesService
remaining_work.present?
end
- def remaining_work_unset?
+ def remaining_work_empty?
remaining_work.nil?
end
- def remaining_work_was_unset?
+ def remaining_work_was_empty?
work_package.remaining_hours_was.nil?
end
@@ -119,11 +119,11 @@ class WorkPackages::SetAttributesService
percent_complete.present?
end
- def percent_complete_unset?
+ def percent_complete_empty?
percent_complete.nil?
end
- def percent_complete_was_unset?
+ def percent_complete_was_empty?
work_package.done_ratio_was.nil?
end
@@ -157,7 +157,7 @@ class WorkPackages::SetAttributesService
end
def remaining_work_from_percent_complete_and_work
- return nil if work_unset? || percent_complete_unset?
+ return nil if work_empty? || percent_complete_empty?
completed_work = work * percent_complete / 100.0
remaining_work = (work - completed_work).round(2)
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 027e9c3cc05..76ef3cf9a18 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
@@ -67,12 +67,12 @@ class WorkPackages::SetAttributesService
end
def update_work
- return if remaining_work_unset? && percent_complete_unset?
+ return if remaining_work_empty? && percent_complete_empty?
return if percent_complete == 100 # would be Infinity if computed when % complete is 100%
return unless work_can_be_derived?
self.work =
- if remaining_work_unset?
+ if remaining_work_empty?
nil
else
work_from_percent_complete_and_remaining_work
@@ -81,15 +81,15 @@ class WorkPackages::SetAttributesService
# rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexity
def update_remaining_work
- return if work_unset? && percent_complete_unset?
- return if work_was_unset? && remaining_work_set? # remaining work is kept and % complete will be set
+ return if work_empty? && percent_complete_empty?
+ return if work_was_empty? && remaining_work_set? # remaining work is kept and % complete will be set
- if work_set? && remaining_work_unset? && percent_complete_unset?
+ if work_set? && remaining_work_empty? && percent_complete_empty?
self.remaining_work = work
elsif work_changed? && work_set? && remaining_work_set? && percent_complete_not_provided_by_user?
delta = work - work_was
self.remaining_work = (remaining_work + delta).clamp(0.0, work)
- elsif work_unset? || percent_complete_unset?
+ elsif work_empty? || percent_complete_empty?
self.remaining_work = nil
else
self.remaining_work = remaining_work_from_percent_complete_and_work
@@ -98,13 +98,13 @@ class WorkPackages::SetAttributesService
# rubocop:enable Metrics/AbcSize,Metrics/PerceivedComplexity
def update_percent_complete
- return if work_unset?
+ return if work_empty?
self.percent_complete = percent_complete_from_work_and_remaining_work
end
def percent_complete_from_work_and_remaining_work
- return nil if work.zero? || remaining_work_unset?
+ return nil if work.zero? || remaining_work_empty?
completed_work = work - remaining_work
completion_ratio = completed_work.to_f / work
@@ -122,15 +122,15 @@ class WorkPackages::SetAttributesService
end
def remaining_work_set_greater_than_work?
- (work_was_unset? || remaining_work_came_from_user?) \
+ (work_was_empty? || remaining_work_came_from_user?) \
&& percent_complete_not_provided_by_user? \
&& work && remaining_work && remaining_work > work
end
def work_can_be_derived?
- work_unset? \
+ work_empty? \
|| (remaining_work_came_from_user? && percent_complete_came_from_user?) \
- || (remaining_work_unset? && remaining_work_came_from_user?)
+ || (remaining_work_empty? && remaining_work_came_from_user?)
end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b5d4509a723..46384005d4a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1155,7 +1155,7 @@ en:
must_be_set_when_work_and_percent_complete_are_set: "required when Work and % Complete are set."
must_be_set_to_zero_hours_when_work_is_set_and_percent_complete_is_100p: >-
must be 0h when Work is set and % Complete is 100%.
- must_be_unset_when_work_is_unset_and_percent_complete_is_100p: >-
+ must_be_empty_when_work_is_empty_and_percent_complete_is_100p: >-
must be empty when Work is empty and % Complete is 100%.
readonly_status: "The work package is in a readonly status so its attributes cannot be changed."
type:
diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rb
index 0c673e26de2..c89622a048d 100644
--- a/spec/contracts/work_packages/base_contract_spec.rb
+++ b/spec/contracts/work_packages/base_contract_spec.rb
@@ -306,7 +306,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is valid"
end
- context "when unset while remaining work and % complete are set" do
+ context "when empty while remaining work and % complete are set" do
let(:estimated_hours) { nil }
let(:remaining_hours) { 2.0 }
let(:done_ratio) { 50 }
@@ -314,7 +314,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is invalid", estimated_hours: :must_be_set_when_remaining_work_and_percent_complete_are_set
end
- context "when unset while remaining work is set and % complete is set to an invalid value" do
+ context "when empty while remaining work is set and % complete is set to an invalid value" do
let(:estimated_hours) { nil }
let(:remaining_hours) { 2.0 }
let(:done_ratio) { 200 }
@@ -324,7 +324,7 @@ RSpec.describe WorkPackages::BaseContract,
done_ratio: :inclusion
end
- context "when unset while % complete is set and remaining work is set to an invalid value" do
+ context "when empty while % complete is set and remaining work is set to an invalid value" do
let(:estimated_hours) { nil }
let(:remaining_hours) { -2.0 }
let(:done_ratio) { 50 }
@@ -415,7 +415,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is valid"
end
- context "when unset while work and % complete are set" do
+ context "when empty while work and % complete are set" do
let(:estimated_hours) { 3 }
let(:remaining_hours) { nil }
let(:done_ratio) { 50 }
@@ -423,7 +423,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is invalid", remaining_hours: :must_be_set_when_work_and_percent_complete_are_set
end
- context "when unset while work is set and % complete is set to an invalid value" do
+ context "when empty while work is set and % complete is set to an invalid value" do
let(:estimated_hours) { 3 }
let(:remaining_hours) { nil }
let(:done_ratio) { -1 }
@@ -433,7 +433,7 @@ RSpec.describe WorkPackages::BaseContract,
done_ratio: :inclusion
end
- context "when unset while % complete is set and work is set to a negative value" do
+ context "when empty while % complete is set and work is set to a negative value" do
let(:estimated_hours) { -3 }
let(:remaining_hours) { nil }
let(:done_ratio) { 50 }
@@ -490,7 +490,7 @@ RSpec.describe WorkPackages::BaseContract,
it_behaves_like "contract is valid"
end
- context "when unset while work and remaining work are set" do
+ context "when empty while work and remaining work are set" do
let(:estimated_hours) { 4 }
let(:remaining_hours) { 3 }
let(:done_ratio) { nil }
@@ -498,7 +498,7 @@ RSpec.describe WorkPackages::BaseContract,
it_behaves_like "contract is invalid", done_ratio: :must_be_set_when_work_and_remaining_work_are_set
end
- context "when unset while work is set and remaining work is set to a negative value" do
+ context "when empty while work is set and remaining work is set to a negative value" do
let(:estimated_hours) { 4 }
let(:remaining_hours) { -3 }
let(:done_ratio) { nil }
@@ -518,7 +518,7 @@ RSpec.describe WorkPackages::BaseContract,
done_ratio: nil
end
- context "when unset while remaining work is set and work is set to a negative value" do
+ context "when empty while remaining work is set and work is set to a negative value" do
let(:estimated_hours) { -4 }
let(:remaining_hours) { 3 }
let(:done_ratio) { nil }
@@ -578,7 +578,7 @@ RSpec.describe WorkPackages::BaseContract,
end
end
- context "when remaining work exceeds work and done_ratio is unset" do
+ context "when remaining work exceeds work and done_ratio is empty" do
let(:estimated_hours) { 5.0 }
let(:remaining_hours) { 6.0 }
let(:done_ratio) { nil }
@@ -590,7 +590,7 @@ RSpec.describe WorkPackages::BaseContract,
done_ratio: nil
end
- context "when all three unset" do
+ context "when all three empty" do
let(:estimated_hours) { nil }
let(:remaining_hours) { nil }
let(:done_ratio) { nil }
@@ -630,7 +630,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is invalid", done_ratio: :cannot_be_set_when_work_is_zero
end
- context "when % complete is unset" do
+ context "when % complete is empty" do
let(:done_ratio) { nil }
include_examples "contract is valid"
@@ -653,7 +653,7 @@ RSpec.describe WorkPackages::BaseContract,
context "and work is set" do
let(:estimated_hours) { 10 }
- context "and remaining work is unset" do
+ context "and remaining work is empty" do
let(:remaining_hours) { nil }
include_examples "contract is invalid",
@@ -678,10 +678,10 @@ RSpec.describe WorkPackages::BaseContract,
end
end
- context "and work is unset" do
+ context "and work is empty" do
let(:estimated_hours) { nil }
- context "and remaining work is unset" do
+ context "and remaining work is empty" do
let(:remaining_hours) { nil }
include_examples "contract is valid"
@@ -691,7 +691,7 @@ RSpec.describe WorkPackages::BaseContract,
let(:remaining_hours) { 0 }
include_examples "contract is invalid", estimated_hours: nil,
- remaining_hours: :must_be_unset_when_work_is_unset_and_percent_complete_is_100p,
+ remaining_hours: :must_be_empty_when_work_is_empty_and_percent_complete_is_100p,
done_ratio: nil
end
@@ -699,13 +699,13 @@ RSpec.describe WorkPackages::BaseContract,
let(:remaining_hours) { 5 }
include_examples "contract is invalid", estimated_hours: nil,
- remaining_hours: :must_be_unset_when_work_is_unset_and_percent_complete_is_100p,
+ remaining_hours: :must_be_empty_when_work_is_empty_and_percent_complete_is_100p,
done_ratio: nil
end
end
end
- context "when work and remaining work are both unset" do
+ context "when work and remaining work are both empty" do
let(:estimated_hours) { nil }
let(:remaining_hours) { nil }
@@ -715,7 +715,7 @@ RSpec.describe WorkPackages::BaseContract,
include_examples "contract is valid"
end
- context "when % complete is unset" do
+ context "when % complete is empty" do
let(:done_ratio) { nil }
include_examples "contract is valid"
diff --git a/spec/features/work_packages/display_fields/work_display_spec.rb b/spec/features/work_packages/display_fields/work_display_spec.rb
index 50b46f3f047..1d345835f2c 100644
--- a/spec/features/work_packages/display_fields/work_display_spec.rb
+++ b/spec/features/work_packages/display_fields/work_display_spec.rb
@@ -116,7 +116,7 @@ RSpec.describe "Work display", :js do
include_examples "work display", expected_text: "0h·Σ 3h"
end
- context "with just total work (parent work unset)" do
+ context "with just total work (parent work empty)" do
let_work_packages(<<~TABLE)
hierarchy | work |
parent | |
diff --git a/spec/features/work_packages/progress_modal_spec.rb b/spec/features/work_packages/progress_modal_spec.rb
index 5da8fbd865d..658c7b13103 100644
--- a/spec/features/work_packages/progress_modal_spec.rb
+++ b/spec/features/work_packages/progress_modal_spec.rb
@@ -369,7 +369,7 @@ RSpec.describe "Progress modal", :js, :with_cuprite,
end
end
- context "with unset values" do
+ context "with empty values" do
before do
update_work_package_with(work_package, estimated_hours: nil, remaining_hours: nil, done_ratio: nil)
end
@@ -430,7 +430,7 @@ RSpec.describe "Progress modal", :js, :with_cuprite,
context "given work = 10h, remaining work = 4h, % complete = 60%" do
before { update_work_package_with(work_package, estimated_hours: 10.0, remaining_hours: 4.0) }
- specify "Case 1: When I unset work it unsets remaining work" do
+ specify "Case 1: When I clear work it clears remaining work" do
visit_progress_query_displaying_work_package
progress_popover.open
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 6d695996233..50ba599878b 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
@@ -83,11 +83,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
work_package.clear_changes_information
end
- context "when work is unset" do
+ context "when work is cleared" do
let(:set_attributes) { { estimated_hours: nil } }
let(:expected_derived_attributes) { { remaining_hours: nil } }
- include_examples "update progress values", description: "unsets remaining work"
+ include_examples "update progress values", description: "clearss remaining work"
end
context "when work is changed" do
@@ -121,7 +121,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
end
end
- context "given a work package with work and remaining work unset, and a status with 0% complete" do
+ context "given a work package with work and remaining work being empty, and a status with 0% complete" do
before do
work_package.status = status_0_pct_complete
work_package.done_ratio = work_package.status.default_done_ratio
@@ -135,7 +135,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
let(:expected_derived_attributes) { { remaining_hours: nil } }
include_examples "update progress values",
- description: "remaining work remains unset"
+ description: "remaining work remains empty"
end
context "when work is set" do
@@ -143,7 +143,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBas
let(:expected_derived_attributes) { { remaining_hours: 10.0 } }
include_examples "update progress values",
- description: "remaining work is updated accordingly from work and % complete value of the status"
+ description: "remaining work is derived from work and % complete value of the status"
end
context "when work is set to a negative value" 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 f1e5de46d8e..0b16320a274 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
@@ -79,31 +79,31 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
work_package.clear_changes_information
end
- context "when work is unset" do
+ context "when work is cleared" do
let(:set_attributes) { { estimated_hours: nil } }
let(:expected_derived_attributes) { { remaining_hours: nil } }
let(:expected_kept_attributes) { %w[done_ratio] }
- include_examples "update progress values", description: "keeps % complete, and unsets remaining work"
+ include_examples "update progress values", description: "keeps % complete, and clears remaining work"
end
- context "when remaining work is unset" do
+ context "when remaining work is cleared" do
let(:set_attributes) { { remaining_hours: nil } }
let(:expected_derived_attributes) { { estimated_hours: nil } }
let(:expected_kept_attributes) { %w[done_ratio] }
- include_examples "update progress values", description: "keeps % complete, and unsets work"
+ include_examples "update progress values", description: "keeps % complete, and clears work"
end
- context "when % complete is unset" do
+ context "when % complete is cleared" do
let(:set_attributes) { { done_ratio: nil } }
let(:expected_derived_attributes) { { remaining_hours: nil } }
let(:expected_kept_attributes) { %w[estimated_hours] }
- include_examples "update progress values", description: "keeps work, and unsets remaining work"
+ include_examples "update progress values", description: "keeps work, and clears remaining work"
end
- context "when both work and remaining work are unset" do
+ context "when both work and remaining work are cleared" do
let(:set_attributes) { { estimated_hours: nil, remaining_hours: nil } }
let(:expected_kept_attributes) { %w[done_ratio] }
@@ -117,14 +117,14 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
include_examples "update progress values", description: "derives remaining work from work and % complete"
end
- context "when both work and percent complete are unset" do
+ context "when both work and percent complete are cleared" do
let(:set_attributes) { { estimated_hours: nil, done_ratio: nil } }
let(:expected_kept_attributes) { %w[remaining_hours] }
include_examples "update progress values", description: "keeps remaining work"
end
- context "when both remaining work and percent complete are unset" do
+ context "when both remaining work and percent complete are cleared" do
let(:set_attributes) { { remaining_hours: nil, done_ratio: nil } }
let(:expected_kept_attributes) { %w[estimated_hours] }
@@ -139,7 +139,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
include_examples "update progress values",
- description: "remaining work is increased by the same amount, and % complete is updated accordingly"
+ description: "remaining work is increased by the same amount, and % complete is derived"
end
context "when work is set to 0h" do
@@ -149,7 +149,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
include_examples "update progress values",
- description: "remaining work is set to 0h and % Complete is unset"
+ description: "remaining work is set to 0h and % Complete is cleared"
end
context "when work is decreased" do
@@ -160,7 +160,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
include_examples "update progress values",
- description: "remaining work is decreased by the same amount, and % complete is updated accordingly"
+ description: "remaining work is decreased by the same amount, and % complete is derived"
end
context "when work is decreased below remaining work value" do
@@ -195,7 +195,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:set_attributes) { { remaining_hours: 12.0, done_ratio: 40 } }
let(:expected_derived_attributes) { { estimated_hours: 20.0 } }
- include_examples "update progress values", description: "work is updated accordingly"
+ include_examples "update progress values", description: "work is derived"
end
context "when remaining work is changed and % complete is changed to 100%" do
@@ -253,32 +253,32 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
include_examples "update progress values", description: "updates % complete accordingly"
end
- context "when work is changed and remaining work is unset" do
+ context "when work is changed and remaining work is cleared" do
let(:set_attributes) { { estimated_hours: 8.0, remaining_hours: nil } }
let(:expected_derived_attributes) { { done_ratio: nil } }
- include_examples "update progress values", description: "% complete is unset"
+ include_examples "update progress values", description: "% complete is cleared"
end
- context "when percent complete is changed and work is unset" do
+ context "when percent complete is changed and work is cleared" do
let(:set_attributes) { { done_ratio: 40, estimated_hours: nil } }
let(:expected_derived_attributes) { { remaining_hours: nil } }
- include_examples "update progress values", description: "remaining work is unset"
+ include_examples "update progress values", description: "remaining work is cleared"
end
- context "when percent complete is changed and remaining work is unset" do
+ context "when percent complete is changed and remaining work is cleared" do
let(:set_attributes) { { done_ratio: 40, remaining_hours: nil } }
let(:expected_derived_attributes) { { estimated_hours: nil } }
- include_examples "update progress values", description: "work is unset"
+ include_examples "update progress values", description: "work is cleared"
end
context "when % complete is changed and remaining work is set to same value" do
let(:set_attributes) { { done_ratio: 90, remaining_hours: 3 } }
let(:expected_derived_attributes) { { estimated_hours: 30 } }
- include_examples "update progress values", description: "work is updated accordingly"
+ include_examples "update progress values", description: "work is derived"
end
context "when work is set to the same value and remaining work is changed" do
@@ -286,7 +286,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { done_ratio: 90 } }
include_examples "update progress values",
- description: "% complete is updated accordingly"
+ description: "% complete is derived"
end
context "when work is increased and remaining work is set to its current value (to prevent it from being increased)" do
@@ -295,7 +295,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { remaining_hours: 3.0, done_ratio: 85 } }
include_examples "update progress values",
- description: "remaining work is kept (not increased), and % complete is updated accordingly"
+ description: "remaining work is kept (not increased), and % complete is derived"
end
context "when % complete is changed" do
@@ -303,7 +303,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { remaining_hours: 6.0 } }
let(:expected_kept_attributes) { %w[estimated_hours] }
- include_examples "update progress values", description: "work is kept, and remaining work is updated accordingly"
+ include_examples "update progress values", description: "work is kept, and remaining work is derived"
end
context "when % complete is changed to a negative value" do
@@ -355,7 +355,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
end
- context "given a work package with work and % complete being set, and remaining work being unset" do
+ context "given a work package with work and % complete being set, and remaining work being empty" do
before do
work_package.estimated_hours = 10
work_package.remaining_hours = nil
@@ -368,7 +368,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { remaining_hours: 14.0 } }
let(:expected_kept_attributes) { %w[done_ratio] }
- include_examples "update progress values", description: "% complete is kept and remaining work is updated accordingly"
+ include_examples "update progress values", description: "% complete is kept and remaining work is derived"
end
context "when work is changed to a negative value" do
@@ -385,7 +385,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { done_ratio: 90.0 } }
let(:expected_kept_attributes) { %w[estimated_hours] }
- include_examples "update progress values", description: "work is kept and % complete is updated accordingly"
+ include_examples "update progress values", description: "work is kept and % complete is derived"
end
context "when % complete is set" do
@@ -393,11 +393,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { remaining_hours: 1.0 } }
let(:expected_kept_attributes) { %w[estimated_hours] }
- include_examples "update progress values", description: "work is kept and remaining work is updated accordingly"
+ include_examples "update progress values", description: "work is kept and remaining work is derived"
end
end
- context "given a work package with remaining work and % complete being set, and work being unset" do
+ context "given a work package with remaining work and % complete being set, and work being empty" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = 2.0
@@ -410,7 +410,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { estimated_hours: 20.0 } }
let(:expected_kept_attributes) { %w[done_ratio] }
- include_examples "update progress values", description: "% complete is kept and work is updated accordingly"
+ include_examples "update progress values", description: "% complete is kept and work is derived"
end
context "when % complete is 0% and remaining work is changed to a decimal rounded up" do
@@ -424,7 +424,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
include_examples "update progress values",
- description: "% complete is kept, values are rounded, and work is updated accordingly"
+ description: "% complete is kept, values are rounded, and work is derived"
end
context "when work is set" do
@@ -432,7 +432,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { done_ratio: 80.0 } }
let(:expected_kept_attributes) { %w[remaining_hours] }
- include_examples "update progress values", description: "remaining work is kept and % complete is updated accordingly"
+ include_examples "update progress values", description: "remaining work is kept and % complete is derived"
end
context "when % complete is changed" do
@@ -440,7 +440,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { estimated_hours: 10.0 } }
let(:expected_kept_attributes) { %w[remaining_hours] }
- include_examples "update progress values", description: "remaining work is kept and work is updated accordingly"
+ include_examples "update progress values", description: "remaining work is kept and work is derived"
end
context "when % complete is changed to 100%" do
@@ -453,7 +453,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
end
- context "given a work package with work being set, and remaining work and % complete being unset" do
+ context "given a work package with work being set, and remaining work and % complete being empty" do
before do
work_package.estimated_hours = 10
work_package.remaining_hours = nil
@@ -469,12 +469,12 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
description: "remaining work is set to the same value and % complete is set to 0%"
end
- context "when work is changed and remaining work is unset" do
+ context "when work is changed and remaining work is cleared" do
let(:set_attributes) { { estimated_hours: 10.0, remaining_hours: nil } }
let(:expected_kept_attributes) { %w[done_ratio] }
include_examples "update progress values",
- description: "% complete is kept and remaining work is kept unset and not recomputed " \
+ description: "% complete is kept and remaining work is kept empty and not recomputed " \
"(error state to be detected by contract)"
end
@@ -493,11 +493,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_kept_attributes) { %w[estimated_hours] }
include_examples "update progress values",
- description: "work is kept and remaining work is updated accordingly"
+ description: "work is kept and remaining work is derived"
end
end
- context "given a work package with remaining work being set, and work and % complete being unset" do
+ context "given a work package with remaining work being set, and work and % complete being cleared" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = 6.0
@@ -511,7 +511,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_kept_attributes) { %w[remaining_hours] }
include_examples "update progress values",
- description: "remaining work is kept to the same value and % complete is updated accordingly"
+ description: "remaining work is kept to the same value and % complete is derived"
end
context "when work is set lower than remaining work" do
@@ -554,11 +554,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { estimated_hours: 10.0 } }
let(:expected_kept_attributes) { %w[remaining_hours] }
- include_examples "update progress values", description: "work is updated accordingly"
+ include_examples "update progress values", description: "work is derived"
end
end
- context "given a work package with work and remaining work set to 0h, and % complete being unset" do
+ context "given a work package with work and remaining work set to 0h, and % complete being empty" do
before do
work_package.estimated_hours = 0
work_package.remaining_hours = 0
@@ -575,7 +575,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
end
- context "given a work package with work and remaining work unset, and % complete being set" do
+ context "given a work package with work and remaining work being empty, and % complete being set" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = nil
@@ -588,7 +588,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_derived_attributes) { { remaining_hours: 4.0 } }
let(:expected_kept_attributes) { %w[done_ratio] }
- include_examples "update progress values", description: "% complete is kept and remaining work is updated accordingly"
+ include_examples "update progress values", description: "% complete is kept and remaining work is derived"
end
context "when work is set to a number with with 4 decimals" do
@@ -598,7 +598,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
include_examples "update progress values",
description: "% complete is kept, work is rounded to 2 decimals, " \
- "and remaining work is updated and rounded to 2 decimals"
+ "and remaining work is derived and rounded to 2 decimals"
end
context "when work is set to a string" do
@@ -618,14 +618,14 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:set_attributes) { { estimated_hours: 10.0, remaining_hours: 0 } }
let(:expected_derived_attributes) { { done_ratio: 100 } }
- include_examples "update progress values", description: "% complete is updated accordingly"
+ include_examples "update progress values", description: "% complete is derived"
end
- context "when work is set and remaining work is unset" do
+ context "when work is set and remaining work is clered" do
let(:set_attributes) { { estimated_hours: 10.0, remaining_hours: nil } }
let(:expected_derived_attributes) { { done_ratio: nil } }
- include_examples "update progress values", description: "% complete is unset"
+ include_examples "update progress values", description: "% complete is cleared"
end
context "when work and remaining work are both set to negative values" do
@@ -641,11 +641,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_kept_attributes) { %w[estimated_hours remaining_hours] }
include_examples "update progress values",
- description: "work and remaining work are kept unset"
+ description: "work and remaining work are kept empty"
end
end
- context "given a work package with work and remaining work unset, and % complete being set to 100%" do
+ context "given a work package with work and remaining work being empty, and % complete being set to 100%" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = nil
@@ -678,7 +678,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:set_attributes) { { estimated_hours: 10.0, remaining_hours: 5.0 } }
let(:expected_derived_attributes) { { done_ratio: 50 } }
- include_examples "update progress values", description: "% complete is updated accordingly"
+ include_examples "update progress values", description: "% complete is derived"
end
context "when remaining work is set to 0h" do
@@ -690,7 +690,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
end
end
- context "given a work package with work, remaining work, and % complete being unset" do
+ context "given a work package with work, remaining work, and % complete being empty" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = nil
@@ -733,12 +733,12 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
"and % complete and work are kept"
end
- context "when remaining work is set and work is unset" do
+ context "when remaining work is set and work is cleared" do
let(:set_attributes) { { estimated_hours: nil, remaining_hours: 6.7 } }
let(:expected_kept_attributes) { %w[done_ratio] }
include_examples "update progress values",
- description: "% complete is kept and work is kept unset and not recomputed" \
+ description: "% complete is kept and work is kept empty and not recomputed" \
"(error state to be detected by contract)"
end
@@ -747,7 +747,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased
let(:expected_kept_attributes) { %w[estimated_hours remaining_hours] }
include_examples "update progress values",
- description: "work and remaining work are kept unset"
+ description: "work and remaining work are kept empty"
end
end
end
diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rb
index b7ffa0a2883..de94a3aaf2c 100644
--- a/spec/services/work_packages/set_attributes_service_spec.rb
+++ b/spec/services/work_packages/set_attributes_service_spec.rb
@@ -172,7 +172,7 @@ RSpec.describe WorkPackages::SetAttributesService,
end
end
- context "given a work package with work and remaining work unset, and a status with 0% complete" do
+ context "given a work package with work and remaining work being empty, and a status with 0% complete" do
before do
work_package.status = status_0_pct_complete
work_package.done_ratio = work_package.status.default_done_ratio
@@ -186,7 +186,7 @@ RSpec.describe WorkPackages::SetAttributesService,
let(:expected_attributes) { { remaining_hours: nil } }
it_behaves_like "service call",
- description: "remaining work remains unset"
+ description: "remaining work remains empty"
end
context "when work is set" do
@@ -194,7 +194,7 @@ RSpec.describe WorkPackages::SetAttributesService,
let(:expected_attributes) { { remaining_hours: 10.0 } }
it_behaves_like "service call",
- description: "remaining work is updated accordingly from work and % complete value of the status"
+ description: "remaining work is derived from work and % complete value of the status"
end
end
end
@@ -209,11 +209,11 @@ RSpec.describe WorkPackages::SetAttributesService,
work_package.clear_changes_information
end
- context "when remaining work is unset" do
+ context "when remaining work is cleared" do
let(:call_attributes) { { remaining_hours: nil } }
let(:expected_attributes) { { estimated_hours: nil, done_ratio: 70 } }
- it_behaves_like "service call", description: "keeps % complete, and unsets work"
+ it_behaves_like "service call", description: "keeps % complete, and clears work"
end
context "when work is increased" do
@@ -224,7 +224,7 @@ RSpec.describe WorkPackages::SetAttributesService,
end
it_behaves_like "service call",
- description: "remaining work is increased by the same amount, and % complete is updated accordingly"
+ description: "remaining work is increased by the same amount, and % complete is derived"
end
context "when work and remaining work are both changed to values with more than 2 decimals" do
@@ -250,7 +250,7 @@ RSpec.describe WorkPackages::SetAttributesService,
end
end
- context "given a work package with work and remaining work unset, and % complete being set" do
+ context "given a work package with work and remaining work being empty, and % complete being set" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = nil
@@ -263,11 +263,11 @@ RSpec.describe WorkPackages::SetAttributesService,
let(:expected_attributes) { { remaining_hours: 4.0 } }
let(:expected_kept_attributes) { %w[done_ratio] }
- it_behaves_like "service call", description: "% complete is kept and remaining work is updated accordingly"
+ it_behaves_like "service call", description: "% complete is kept and remaining work is derived"
end
end
- context "given a work package with work, remaining work, and % complete being unset" do
+ context "given a work package with work, remaining work, and % complete being empty" do
before do
work_package.estimated_hours = nil
work_package.remaining_hours = nil