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
Use string attributes for custom_field_changes to align it with non custom field attribute changes. Fix specs.
Dombi Attilab94e3cb75731
diff --git a/spec/requests/api/v3/projects/update_resource_spec.rb b/spec/requests/api/v3/projects/update_resource_spec.rbindex e0db2b45dcd..47d2bb2e285 100644--- a/spec/requests/api/v3/projects/update_resource_spec.rb+++ b/spec/requests/api/v3/projects/update_resource_spec.rb@@ -341,8 +341,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 200 OK" do- expect(last_response.status)- .to eq(200)+ expect(last_response)+ .to have_http_status(200)endit "archives the project" do@@ -360,8 +360,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { [:edit_project] }it "responds with 403" do- expect(last_response.status)- .to eq(403)+ expect(last_response)+ .to have_http_status(403)endit "does not alter the project" do@@ -374,8 +374,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { [:archive_project] }it "responds with 200 OK" do- expect(last_response.status)- .to eq(200)+ expect(last_response)+ .to have_http_status(200)endit "archives the project" do@@ -394,8 +394,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:child_project) { create(:project) }it "responds with 422 (and not 403?)" do- expect(last_response.status)- .to eq(422)+ expect(last_response)+ .to have_http_status(422)endit "does not alter the project" do@@ -429,8 +429,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 200 OK" do- expect(last_response.status)- .to eq(200)+ expect(last_response)+ .to have_http_status(200)endit "sets the cf value" do@@ -453,8 +453,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { [:edit_project] }it "responds with 403" do- expect(last_response.status)- .to eq(403)+ expect(last_response)+ .to have_http_status(403)endend@@ -462,17 +462,26 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { [:archive_project] }it "responds with 403" do- expect(last_response.status)- .to eq(403)+ expect(last_response)+ .to have_http_status(403)endend- context "for a user with both archive_project and edit_project permissions" do+ context "for a user with archive_project and edit_project permissions" dolet(:permissions) { %i[archive_project edit_project] }+ it "responds with 422 unprocessable_entity" do+ expect(last_response)+ .to have_http_status(422)+ end+ end++ context "for a user with archive_project and edit_project and edit_project_attributes permissions" do+ let(:permissions) { %i[archive_project edit_project edit_project_attributes] }+it "responds with 200 OK" do- expect(last_response.status)- .to eq(200)+ expect(last_response)+ .to have_http_status(200)endendend@@ -499,8 +508,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 200 OK" do- expect(last_response.status)- .to eq(200)+ expect(last_response)+ .to have_http_status(200)endit "unarchives the project" do@@ -518,8 +527,8 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { %i[archive_project edit_project] }it "responds with 404" do- expect(last_response.status)- .to eq(404)+ expect(last_response)+ .to have_http_status(404)endit "does not alter the project" dodiff --git a/spec/support/shared/acts_as_customizable.rb b/spec/support/shared/acts_as_customizable.rbindex 58155b4577b..0ceb7a155eb 100644--- a/spec/support/shared/acts_as_customizable.rb+++ b/spec/support/shared/acts_as_customizable.rb@@ -45,7 +45,7 @@ RSpec.shared_examples_for "acts_as_customizable included" doit "returns the field changes" domodel_instance.custom_field_values = { custom_field.id => "test" }expect(model_instance.custom_field_changes)- .to eq({ custom_field.attribute_name.to_sym => [nil, "test"] })+ .to eq({ custom_field.attribute_name => [nil, "test"] })endendend@@ -54,7 +54,7 @@ RSpec.shared_examples_for "acts_as_customizable included" doit "returns the field changes" domodel_instance.custom_field_values = { custom_field.id => "test" }expect(model_instance.custom_field_changes)- .to eq({ custom_field.attribute_name.to_sym => [nil, "test"] })+ .to eq({ custom_field.attribute_name => [nil, "test"] })endend@@ -67,7 +67,7 @@ RSpec.shared_examples_for "acts_as_customizable included" doit "returns the field changes" domodel_instance.custom_field_values = { custom_field.id => "test2" }expect(model_instance.custom_field_changes)- .to eq({ custom_field.attribute_name.to_sym => ["test", "test2"] })+ .to eq({ custom_field.attribute_name => ["test", "test2"] })endend@@ -92,7 +92,7 @@ RSpec.shared_examples_for "acts_as_customizable included" doit "returns the field changes" domodel_instance.custom_field_values = { custom_field.id => nil }expect(model_instance.custom_field_changes)- .to eq({ custom_field.attribute_name.to_sym => ["test", nil] })+ .to eq({ custom_field.attribute_name => ["test", nil] })endendend