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

Satisfy rubocop

Judith Rothe271f113e8bd
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_form_component.rb b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_form_component.rb
index bf6b51d6892..1693de4871f 100644
--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_form_component.rb
+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_form_component.rb
@@ -29,13 +29,13 @@
module Settings
module ProjectCustomFields
module ProjectCustomFieldMapping
- class NewProjectMappingFormComponent < ApplicationComponent
+ class NewProjectMappingFormComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
include OpTurbo::Streamable
- DIALOG_ID = "settings--new-project-custom-field-mapping-component"
- DIALOG_BODY_ID = "settings--new-project-custom-field-mapping-body-component"
+ DIALOG_ID = "settings--new-project-custom-field-mapping-component".freeze
+ DIALOG_BODY_ID = "settings--new-project-custom-field-mapping-body-component".freeze
- def initialize(project_mapping:, project_custom_field: )
+ def initialize(project_mapping:, project_custom_field:)
super
@project_mapping = project_mapping
@project_custom_field = project_custom_field
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rb
index 625e51d5ce9..09ef27e4aee 100644
--- a/app/controllers/admin/settings/project_custom_fields_controller.rb
+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb
@@ -39,8 +39,7 @@ module Admin::Settings
# rubocop:disable Rails/LexicallyScopedActionFilter
before_action :set_sections, only: %i[show index edit update move drop]
- before_action :find_custom_field,
- only: %i(show edit project_mappings new_link link unlink update destroy delete_option reorder_alphabetical move drop)
+ before_action :find_custom_field, except: %i(index new)
before_action :prepare_custom_option_position, only: %i(update create)
before_action :find_custom_option, only: :delete_option
before_action :project_custom_field_mappings_query, only: %i[project_mappings unlink]
@@ -204,10 +203,10 @@ module Admin::Settings
project_mapping = ProjectCustomFieldProjectMapping.new(project_custom_field: @custom_field)
project_mapping.errors.add(:project_ids, :blank)
component = Settings::ProjectCustomFields::ProjectCustomFieldMapping::NewProjectMappingFormComponent.new(
- project_mapping: project_mapping,
+ project_mapping:,
project_custom_field: @custom_field
)
- update_via_turbo_stream(component: component, status: :bad_request)
+ update_via_turbo_stream(component:, status: :bad_request)
respond_with_turbo_streams
false
end
diff --git a/spec/features/admin/project_custom_fields/project_mappings_spec.rb b/spec/features/admin/project_custom_fields/project_mappings_spec.rb
index b5571a328f1..22d5339a287 100644
--- a/spec/features/admin/project_custom_fields/project_mappings_spec.rb
+++ b/spec/features/admin/project_custom_fields/project_mappings_spec.rb
@@ -88,7 +88,7 @@ RSpec.describe "Project Custom Field Mappings", :js do
it "shows an error in the dialog when no project is selected before adding" do
create(:project)
- expect(page).not_to have_css("dialog")
+ expect(page).to have_no_css("dialog")
click_on "Add projects"
page.within("dialog") do