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
Fix specs for removing _limi_custom_fields_validation_to_section_id in Projects::UpdateContract
Dombi Attila8cf0732f2457
diff --git a/spec/models/projects/customizable_spec.rb b/spec/models/projects/customizable_spec.rbindex 2dffb1136d2..b9d5d72ffb3 100644--- a/spec/models/projects/customizable_spec.rb+++ b/spec/models/projects/customizable_spec.rb@@ -190,7 +190,7 @@ RSpec.describe Project, "customizable" doexpect { project.save! }.to raise_error(ActiveRecord::RecordInvalid)end- it "temporarly validates only custom values of a section if section scope is provided while updating" do+ it "validates only custom values of a section if section scope is provided while updating" doproject = create(:project, custom_field_values: {text_custom_field.id => "foo",bool_custom_field.id => true,@@ -217,7 +217,8 @@ RSpec.describe Project, "customizable" doexpect { project.save! }.not_to raise_error- # section scope is resetted after each update+ # Removing the section scoped limitation should result a validation error again.+ project._limit_custom_fields_validation_to_section_id = nilexpect { project.save! }.to raise_error(ActiveRecord::RecordInvalid)endenddiff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rbindex 53c5bad035b..3c511e35298 100644--- a/spec/services/projects/update_service_spec.rb+++ b/spec/services/projects/update_service_spec.rb@@ -79,5 +79,14 @@ RSpec.describe Projects::UpdateService, type: :model dosubjectendend++ describe "section based validation" do+ it "is reset after the save is done" do+ model_instance._limit_custom_fields_validation_to_section_id = 1+ subject+ # section scope is reset after the update+ expect(model_instance._limit_custom_fields_validation_to_section_id).to be_nil+ end+ endendend