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
[#66412] fixed method signature is controller
Eric Schubert52d0fdfc61de
diff --git a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb b/app/controllers/admin/custom_fields/hierarchy/items_controller.rbindex 6b53f291e2c..bb0786ed228 100644--- a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb+++ b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb@@ -62,7 +62,7 @@ module Admindef createitem_service- .insert_item(contract: create_contract, **item_input)+ .insert_item(contract_class: create_contract, **item_input).either(lambda do |item|redirect_to(@@ -80,7 +80,7 @@ module Admindef updateinput = item_inputitem_service- .update_item(contract: update_contract,+ .update_item(contract_class: update_contract,item: @active_item,label: input[:label],short: input[:short],@@ -163,7 +163,7 @@ module Adminenddef add_errors_to_edit_form(validation_result)- @active_item.assign_attributes(**validation_result.to_h.slice(:label, :short))+ @active_item.assign_attributes(**validation_result.to_h.slice(:label, :short, :score))validation_result.errors(full: true).to_h.each do |attribute, errors|@active_item.errors.add(attribute, errors.join(", "))diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 158525bc795..e4493706a2f 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -366,6 +366,7 @@ en:int?: "must be an integer."decimal?: "must be a decimal."filled?: "must be filled."+ key?: "is missing."greater_or_equal_zero: "must be greater or equal to 0."not_found: "not found."rules:@@ -388,6 +389,7 @@ en:depth: "Depth"item: "Item"label: "Label"+ score: "Score"short: "Short name"parent: "Parent"blueprint: "Pattern blueprint"diff --git a/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rbindex 1ad6fb92fff..20acaad2a95 100644--- a/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb@@ -46,6 +46,28 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doendend+ context "when inputs are empty" do+ let(:params) { { parent:, label: "", score: "" } }++ it "is invalid" do+ result = subject.call(params)+ expect(result).to be_failure+ expect(result.errors.to_h).to include(label: ["must be filled."])+ expect(result.errors.to_h).to include(score: ["must be filled."])+ end+ end++ context "when inputs are missing" do+ let(:params) { { parent: } }++ it "is invalid" do+ result = subject.call(params)+ expect(result).to be_failure+ expect(result.errors.to_h).to include(label: ["is missing."])+ expect(result.errors.to_h).to include(score: ["is missing."])+ end+ end+context "when parent is not of type 'Item'" dolet(:invalid_parent) { create(:custom_field) }let(:params) { { parent: invalid_parent, label: "Valid Label", score: 0.1337 } }