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

Test default value for the migrated field changes

Dombi Attila6cc78f8b6d02
diff --git a/spec/migrations/rename_visible_to_admin_only_in_custom_fields_spec.rb b/spec/migrations/rename_visible_to_admin_only_in_custom_fields_spec.rb
index 50035e0d7fa..b6ac4a19606 100644
--- a/spec/migrations/rename_visible_to_admin_only_in_custom_fields_spec.rb
+++ b/spec/migrations/rename_visible_to_admin_only_in_custom_fields_spec.rb
@@ -51,6 +51,13 @@ RSpec.describe RenameVisibleToAdminOnlyInCustomFields, type: :model do
.to change { CustomField.first.attributes.slice("visible", "admin_only") }
.from("visible" => false)
.to("admin_only" => true)
+
+ # it changes the default value to false
+ ProjectCustomField.reset_column_information
+ custom_field = ProjectCustomField.new
+ custom_field.save(validate: false)
+
+ expect(custom_field.admin_only).to be false
end
end
@@ -64,6 +71,13 @@ RSpec.describe RenameVisibleToAdminOnlyInCustomFields, type: :model do
.to change { CustomField.first.attributes.slice("visible", "admin_only") }
.from("admin_only" => false)
.to("visible" => true)
+
+ # it changes the default value to tru
+ ProjectCustomField.reset_column_information
+ custom_field = ProjectCustomField.new
+ custom_field.save(validate: false)
+
+ expect(custom_field.visible).to be true
end
end
end