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
auto correct quotes
Ivan Kuchin6678cab48d44
diff --git a/app/components/mailer/label_component.rb b/app/components/mailer/label_component.rbindex bfe254a3703..ac7f62c3285 100644--- a/app/components/mailer/label_component.rb+++ b/app/components/mailer/label_component.rb@@ -30,16 +30,16 @@module MailerLABEL_SCHEME_COLORS = {- default: 'rgb(208, 215, 222)',- primary: 'rgb(110, 119, 129)',- secondary: 'rgb(208, 215, 222)',- accent: 'rgb(9, 105, 218)',- success: 'rgb(31, 136, 61)',- attention: 'rgb(154, 103, 0)',- danger: 'rgb(207, 34, 46)',- severe: 'rgb(188, 76, 0)',- done: 'rgb(130, 80, 223)',- sponsor: 'rgb(191, 57, 137)'+ default: "rgb(208, 215, 222)",+ primary: "rgb(110, 119, 129)",+ secondary: "rgb(208, 215, 222)",+ accent: "rgb(9, 105, 218)",+ success: "rgb(31, 136, 61)",+ attention: "rgb(154, 103, 0)",+ danger: "rgb(207, 34, 46)",+ severe: "rgb(188, 76, 0)",+ done: "rgb(130, 80, 223)",+ sponsor: "rgb(191, 57, 137)"}.freezeclass LabelComponent < ViewComponent::Basediff --git a/app/components/projects/settings/project_custom_field_sections/index_component.rb b/app/components/projects/settings/project_custom_field_sections/index_component.rbindex 38f061e9a5f..3ea8e301d04 100644--- a/app/components/projects/settings/project_custom_field_sections/index_component.rb+++ b/app/components/projects/settings/project_custom_field_sections/index_component.rb@@ -45,8 +45,8 @@ module Projectsdef wrapper_data_attributes{- controller: 'projects--settings--project-custom-fields-mapping-filter',- 'application-target': 'dynamic'+ controller: "projects--settings--project-custom-fields-mapping-filter",+ "application-target": "dynamic"}endenddiff --git a/app/components/settings/project_custom_field_sections/index_component.rb b/app/components/settings/project_custom_field_sections/index_component.rbindex 7f4d7bdff1a..8693b2a586b 100644--- a/app/components/settings/project_custom_field_sections/index_component.rb+++ b/app/components/settings/project_custom_field_sections/index_component.rb@@ -47,23 +47,23 @@ module Settingsdef wrapper_data_attributes{- controller: 'generic-drag-and-drop',- 'application-target': 'dynamic'+ controller: "generic-drag-and-drop",+ "application-target": "dynamic"}enddef drop_target_config{- 'is-drag-and-drop-target': true,- 'target-allowed-drag-type': 'section' # the type of dragged items which are allowed to be dropped in this target+ "is-drag-and-drop-target": true,+ "target-allowed-drag-type": "section" # the type of dragged items which are allowed to be dropped in this target}enddef draggable_item_config(section){- 'draggable-id': section.id,- 'draggable-type': 'section',- 'drop-url': drop_admin_settings_project_custom_field_section_path(section)+ "draggable-id": section.id,+ "draggable-type": "section",+ "drop-url": drop_admin_settings_project_custom_field_section_path(section)}endenddiff --git a/app/contracts/base_contract.rb b/app/contracts/base_contract.rbindex 9402f313181..18838af93b5 100644--- a/app/contracts/base_contract.rb+++ b/app/contracts/base_contract.rb@@ -101,7 +101,7 @@ class BaseContract < Disposable::Twinprivatedef add_writable(attribute, writable)- attribute_name = attribute.to_s.delete_suffix('_id')+ attribute_name = attribute.to_s.delete_suffix("_id")unless writable == falsewritable_attributes << attribute_name@@ -260,7 +260,7 @@ class BaseContract < Disposable::Twinattribute_permissions = collect_ancestor_attributes(:attribute_permissions)attributes.reject do |attribute|- canonical_attribute = attribute.delete_suffix('_id')+ canonical_attribute = attribute.delete_suffix("_id")permissions = attribute_permissions[canonical_attribute] ||attribute_permissions["#{canonical_attribute}_id"] ||diff --git a/app/controllers/admin/settings/projects_settings_controller.rb b/app/controllers/admin/settings/projects_settings_controller.rbindex 11355769a88..69e1cd2e8ac 100644--- a/app/controllers/admin/settings/projects_settings_controller.rb+++ b/app/controllers/admin/settings/projects_settings_controller.rb@@ -48,9 +48,9 @@ module Admin::Settings.select { |m| m[:dependencies] && enabled_modules.include?(m[:name]) && (m[:dependencies] & enabled_modules) != m[:dependencies] }.map do |m|I18n.t(- 'settings.projects.missing_dependencies',+ "settings.projects.missing_dependencies",module: I18n.t("project_module_#{m[:name]}"),- dependencies: m[:dependencies].map { |dep| I18n.t("project_module_#{dep}") }.join(', ')+ dependencies: m[:dependencies].map { |dep| I18n.t("project_module_#{dep}") }.join(", "))enddiff --git a/app/controllers/concerns/custom_fields/shared_actions.rb b/app/controllers/concerns/custom_fields/shared_actions.rbindex 1e8265f0e76..a2b54097a7c 100644--- a/app/controllers/concerns/custom_fields/shared_actions.rb+++ b/app/controllers/concerns/custom_fields/shared_actions.rb@@ -32,7 +32,7 @@ module CustomFieldsincluded dodef index_path(custom_field, params = {})- if custom_field.type == 'ProjectCustomField'+ if custom_field.type == "ProjectCustomField"admin_settings_project_custom_fields_path(**params)elsecustom_fields_path(**params)@@ -40,7 +40,7 @@ module CustomFieldsenddef edit_path(custom_field, params = {})- if custom_field.type == 'ProjectCustomField'+ if custom_field.type == "ProjectCustomField"admin_settings_project_custom_field_path(**params)elseedit_custom_field_path(**params)@@ -58,7 +58,7 @@ module CustomFieldsredirect_to index_path(call.result, tab: call.result.class.name)else@custom_field = call.result || new_custom_field- render action: 'new'+ render action: "new"endend@@ -76,7 +76,7 @@ module CustomFieldscall_hook(:controller_custom_fields_edit_after_save, custom_field: @custom_field)redirect_back_or_default(edit_path(@custom_field, id: @custom_field.id))else- render action: 'edit'+ render action: "edit"endenddiff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rbindex b35ed052dd1..7b8c5bfa0d4 100644--- a/app/controllers/custom_fields_controller.rb+++ b/app/controllers/custom_fields_controller.rb@@ -28,7 +28,7 @@class CustomFieldsController < ApplicationControllerinclude CustomFields::SharedActions # share logic with ProjectCustomFieldsControlller- layout 'admin'+ layout "admin"before_action :require_adminbefore_action :find_custom_field, only: %i(edit update destroy delete_option reorder_alphabetical)@@ -38,12 +38,12 @@ class CustomFieldsController < ApplicationControllerdef index# loading wp cfs exclicity to allow for eager loading@custom_fields_by_type = CustomField.all- .where.not(type: ['WorkPackageCustomField', 'ProjectCustomField'])+ .where.not(type: ["WorkPackageCustomField", "ProjectCustomField"]).group_by { |f| f.class.name }- @custom_fields_by_type['WorkPackageCustomField'] = WorkPackageCustomField.includes(:types).all+ @custom_fields_by_type["WorkPackageCustomField"] = WorkPackageCustomField.includes(:types).all- @tab = params[:tab] || 'WorkPackageCustomField'+ @tab = params[:tab] || "WorkPackageCustomField"enddef new@@ -59,10 +59,10 @@ class CustomFieldsController < ApplicationControllerprotecteddef default_breadcrumb- if action_name == 'index'- t('label_custom_field_plural')+ if action_name == "index"+ t("label_custom_field_plural")else- ActionController::Base.helpers.link_to(t('label_custom_field_plural'), custom_fields_path)+ ActionController::Base.helpers.link_to(t("label_custom_field_plural"), custom_fields_path)endend@@ -78,8 +78,8 @@ class CustomFieldsController < ApplicationControllerdef check_custom_field# ProjecCustomFields now managed in a different UI- if @custom_field.nil? || @custom_field.type == 'ProjectCustomField'- flash[:error] = 'Invalid CF type'+ if @custom_field.nil? || @custom_field.type == "ProjectCustomField"+ flash[:error] = "Invalid CF type"redirect_to action: :indexendenddiff --git a/app/forms/custom_fields/inputs/base/autocomplete/multi_value_input.rb b/app/forms/custom_fields/inputs/base/autocomplete/multi_value_input.rbindex 76de92b4f45..f8a5f756220 100644--- a/app/forms/custom_fields/inputs/base/autocomplete/multi_value_input.rb+++ b/app/forms/custom_fields/inputs/base/autocomplete/multi_value_input.rb@@ -31,7 +31,7 @@ class CustomFields::Inputs::Base::Autocomplete::MultiValueInput < CustomFields::base_input_attributes.merge(autocomplete_options:,wrapper_data_attributes: {- 'qa-field-name': qa_field_name+ "qa-field-name": qa_field_name})end@@ -57,6 +57,6 @@ class CustomFields::Inputs::Base::Autocomplete::MultiValueInput < CustomFields::enddef validation_message- custom_values.map { |custom_value| custom_value.errors.full_messages }.join(', ') if invalid?+ custom_values.map { |custom_value| custom_value.errors.full_messages }.join(", ") if invalid?endenddiff --git a/app/forms/custom_fields/inputs/base/autocomplete/single_value_input.rb b/app/forms/custom_fields/inputs/base/autocomplete/single_value_input.rbindex ce6c7fcd740..d067a42478a 100644--- a/app/forms/custom_fields/inputs/base/autocomplete/single_value_input.rb+++ b/app/forms/custom_fields/inputs/base/autocomplete/single_value_input.rb@@ -31,7 +31,7 @@ class CustomFields::Inputs::Base::Autocomplete::SingleValueInput < CustomFields:base_input_attributes.merge(autocomplete_options:,wrapper_data_attributes: {- 'qa-field-name': qa_field_name+ "qa-field-name": qa_field_name})enddiff --git a/app/forms/custom_fields/inputs/base/autocomplete/user_query_utils.rb b/app/forms/custom_fields/inputs/base/autocomplete/user_query_utils.rbindex 8aa77123129..ad2460cf8c4 100644--- a/app/forms/custom_fields/inputs/base/autocomplete/user_query_utils.rb+++ b/app/forms/custom_fields/inputs/base/autocomplete/user_query_utils.rb@@ -29,7 +29,7 @@module CustomFields::Inputs::Base::Autocomplete::UserQueryUtilsdef user_autocomplete_options{- component: 'opce-user-autocompleter',+ component: "opce-user-autocompleter",defaultData: false,placeholder: I18n.t(:label_user_search),resource:,@@ -43,18 +43,18 @@ module CustomFields::Inputs::Base::Autocomplete::UserQueryUtilsenddef resource- 'principals'+ "principals"enddef search_key- 'any_name_attribute'+ "any_name_attribute"enddef filters[- { name: 'type', operator: '=', values: ['User', 'Group', 'PlaceholderUser'] },- { name: 'member', operator: '=', values: [@object.id.to_s] },- { name: 'status', operator: '!', values: [Principal.statuses["locked"].to_s] }+ { name: "type", operator: "=", values: ["User", "Group", "PlaceholderUser"] },+ { name: "member", operator: "=", values: [@object.id.to_s] },+ { name: "status", operator: "!", values: [Principal.statuses["locked"].to_s] }]endenddiff --git a/app/forms/custom_fields/inputs/base/input.rb b/app/forms/custom_fields/inputs/base/input.rbindex a578a692ef9..5f00afda992 100644--- a/app/forms/custom_fields/inputs/base/input.rb+++ b/app/forms/custom_fields/inputs/base/input.rb@@ -40,7 +40,7 @@ class CustomFields::Inputs::Base::Input < ApplicationFormdef input_attributesbase_input_attributes.merge({- data: { 'qa-field-name': qa_field_name },+ data: { "qa-field-name": qa_field_name },value:})@@ -55,6 +55,6 @@ class CustomFields::Inputs::Base::Input < ApplicationFormenddef validation_message- custom_value.errors.full_messages.join(', ') if invalid?+ custom_value.errors.full_messages.join(", ") if invalid?endenddiff --git a/app/forms/custom_fields/inputs/base/utils.rb b/app/forms/custom_fields/inputs/base/utils.rbindex 5d517a04fe0..fe786cc07fd 100644--- a/app/forms/custom_fields/inputs/base/utils.rb+++ b/app/forms/custom_fields/inputs/base/utils.rb@@ -60,6 +60,6 @@ module CustomFields::Inputs::Base::Utils# used within autocompleter inputsdef append_to- options.fetch(:wrapper_id, 'body')+ options.fetch(:wrapper_id, "body")endenddiff --git a/app/forms/work_packages/share/invitee.rb b/app/forms/work_packages/share/invitee.rbindex ad08a74c283..de2d34f7369 100644--- a/app/forms/work_packages/share/invitee.rb+++ b/app/forms/work_packages/share/invitee.rb@@ -30,27 +30,27 @@ module WorkPackages::Shareform do |user_invite_form|user_invite_form.autocompleter(name: :user_id,- label: I18n.t('work_package.sharing.label_search'),+ label: I18n.t("work_package.sharing.label_search"),visually_hide_label: true,- data: { 'work-packages--share--user-limit-target': 'autocompleter' },+ data: { "work-packages--share--user-limit-target": "autocompleter" },autocomplete_options: {- component: 'opce-user-autocompleter',+ component: "opce-user-autocompleter",defaultData: false,id: "op-share-wp-invite-autocomplete",- placeholder: I18n.t('work_package.sharing.label_search_placeholder'),+ placeholder: I18n.t("work_package.sharing.label_search_placeholder"),data: {- 'test-selector': 'op-share-wp-invite-autocomplete'+ "test-selector": "op-share-wp-invite-autocomplete"},url: ::API::V3::Utilities::PathHelper::ApiV3Path.principals,- filters: [{ name: 'type', operator: '=', values: %w[User Group] },- { name: 'id', operator: '!', values: [::Queries::Filters::MeValue::KEY] },- { name: 'status', operator: '=', values: [Principal.statuses[:active], Principal.statuses[:invited]] }],- searchKey: 'any_name_attribute',+ filters: [{ name: "type", operator: "=", values: %w[User Group] },+ { name: "id", operator: "!", values: [::Queries::Filters::MeValue::KEY] },+ { name: "status", operator: "=", values: [Principal.statuses[:active], Principal.statuses[:invited]] }],+ searchKey: "any_name_attribute",addTag: User.current.allowed_globally?(:create_user),- addTagText: I18n.t('members.send_invite_to'),+ addTagText: I18n.t("members.send_invite_to"),multiple: true,focusDirectly: true,- appendTo: 'body',+ appendTo: "body",disabled: @disabled})diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rbindex 4e9434ff4ee..6d93fdb5427 100644--- a/app/helpers/custom_fields_helper.rb+++ b/app/helpers/custom_fields_helper.rb@@ -30,32 +30,32 @@ module CustomFieldsHelperdef custom_fields_tabs[{- name: 'WorkPackageCustomField',- partial: 'custom_fields/tab',+ name: "WorkPackageCustomField",+ partial: "custom_fields/tab",path: custom_fields_path(tab: :WorkPackageCustomField),label: :label_work_package_plural},{- name: 'TimeEntryCustomField',- partial: 'custom_fields/tab',+ name: "TimeEntryCustomField",+ partial: "custom_fields/tab",path: custom_fields_path(tab: :TimeEntryCustomField),label: :label_spent_time},{- name: 'VersionCustomField',- partial: 'custom_fields/tab',+ name: "VersionCustomField",+ partial: "custom_fields/tab",path: custom_fields_path(tab: :VersionCustomField),label: :label_version_plural},{- name: 'UserCustomField',- partial: 'custom_fields/tab',+ name: "UserCustomField",+ partial: "custom_fields/tab",path: custom_fields_path(tab: :UserCustomField),label: :label_user_plural},{- name: 'GroupCustomField',- partial: 'custom_fields/tab',+ name: "GroupCustomField",+ partial: "custom_fields/tab",path: custom_fields_path(tab: :GroupCustomField),label: :label_group_plural}@@ -71,71 +71,71 @@ module CustomFieldsHelperfield_format = OpenProject::CustomFieldFormat.find_by_name(custom_field.field_format)tag = case field_format.try(:edit_as)- when 'date'- angular_component_tag 'op-basic-single-date-picker',+ when "date"+ angular_component_tag "op-basic-single-date-picker",inputs: {required: custom_field.is_required,value: custom_value.value,id: field_id,name: field_name}- when 'text'- styled_text_area_tag(field_name, custom_value.value, id: field_id, rows: 3, container_class: '-middle',+ when "text"+ styled_text_area_tag(field_name, custom_value.value, id: field_id, rows: 3, container_class: "-middle",required: custom_field.is_required)- when 'bool'- hidden_tag = hidden_field_tag(field_name, '0')- checkbox_tag = styled_check_box_tag(field_name, '1', custom_value.typed_value, id: field_id,+ when "bool"+ hidden_tag = hidden_field_tag(field_name, "0")+ checkbox_tag = styled_check_box_tag(field_name, "1", custom_value.typed_value, id: field_id,required: custom_field.is_required)hidden_tag + checkbox_tag- when 'list'+ when "list"blank_option = if custom_field.is_required? && custom_field.default_value.blank?"<option value=\"\">--- #{I18n.t(:actionview_instancetag_blank_option)} ---</option>"elsif custom_field.is_required? && custom_field.default_value.present?- ''+ ""else- '<option></option>'+ "<option></option>"endoptions = blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized),custom_value.value)- styled_select_tag(field_name, options, id: field_id, container_class: '-middle', required: custom_field.is_required)+ styled_select_tag(field_name, options, id: field_id, container_class: "-middle", required: custom_field.is_required)else- styled_text_field_tag(field_name, custom_value.value, id: field_id, container_class: '-middle',+ styled_text_field_tag(field_name, custom_value.value, id: field_id, container_class: "-middle",required: custom_field.is_required)end- tag = content_tag :span, tag, lang: custom_field.name_locale, class: 'form--field-container'+ tag = content_tag :span, tag, lang: custom_field.name_locale, class: "form--field-container"if custom_value.errors.empty?tagelse- ActionView::Base.wrap_with_error_span(tag, custom_value, 'value')+ ActionView::Base.wrap_with_error_span(tag, custom_value, "value")endend# Return custom field label tagdef custom_field_label_tag(name, custom_value)- content_tag 'label', h(custom_value.custom_field.name) +- (custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),+ content_tag "label", h(custom_value.custom_field.name) ++ (custom_value.custom_field.is_required? ? content_tag("span", " *", class: "required") : ""),for: "#{name}_custom_field_values_#{custom_value.custom_field.id}",class: "form--label #{custom_value.errors.empty? ? nil : 'error'}",lang: custom_value.custom_field.name_localeenddef hidden_custom_field_label_tag(name, custom_value)- content_tag 'label', h(custom_value.custom_field.name) +- (custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),+ content_tag "label", h(custom_value.custom_field.name) ++ (custom_value.custom_field.is_required? ? content_tag("span", " *", class: "required") : ""),for: "#{name}_custom_field_values_#{custom_value.custom_field.id}",class: "hidden-for-sighted",lang: custom_value.custom_field.name_localeenddef blank_custom_field_label_tag(name, custom_field)- content_tag 'label', h(custom_field.name) +- (custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),+ content_tag "label", h(custom_field.name) ++ (custom_field.is_required? ? content_tag("span", " *", class: "required") : ""),for: "#{name}_custom_field_values_#{custom_field.id}",- class: 'form--label'+ class: "form--label"end# Return custom field tag with its label tag@@ -149,37 +149,37 @@ module CustomFieldsHelperfield_format = OpenProject::CustomFieldFormat.find_by_name(custom_field.field_format)case field_format.try(:edit_as)- when 'date'- angular_component_tag 'op-modal-single-date-picker',+ when "date"+ angular_component_tag "op-modal-single-date-picker",inputs: {id: field_id,name: field_name}- when 'text'- styled_text_area_tag(field_name, '', id: field_id, rows: 3, with_text_formatting: true)- when 'bool'- styled_select_tag(field_name, options_for_select([[I18n.t(:label_no_change_option), ''],- ([I18n.t(:label_none), 'none'] unless custom_field.required?),- [I18n.t(:general_text_yes), '1'],- [I18n.t(:general_text_no), '0']].compact), id: field_id)- when 'list'- base_options = [[I18n.t(:label_no_change_option), '']]+ when "text"+ styled_text_area_tag(field_name, "", id: field_id, rows: 3, with_text_formatting: true)+ when "bool"+ styled_select_tag(field_name, options_for_select([[I18n.t(:label_no_change_option), ""],+ ([I18n.t(:label_none), "none"] unless custom_field.required?),+ [I18n.t(:general_text_yes), "1"],+ [I18n.t(:general_text_no), "0"]].compact), id: field_id)+ when "list"+ base_options = [[I18n.t(:label_no_change_option), ""]]unless custom_field.required?- unset_label = custom_field.field_format == 'user' ? :label_nobody : :label_none- base_options << [I18n.t(unset_label), 'none']+ unset_label = custom_field.field_format == "user" ? :label_nobody : :label_none+ base_options << [I18n.t(unset_label), "none"]endstyled_select_tag(field_name,options_for_select(base_options + custom_field.possible_values_options(project)),id: field_id,multiple: custom_field.multi_value?)else- styled_text_field_tag(field_name, '', id: field_id)+ styled_text_field_tag(field_name, "", id: field_id)endend# Return a string used to display a custom valuedef show_value(custom_value)- return '' unless custom_value+ return "" unless custom_valuecustom_value.formatted_valueenddiff --git a/app/models/custom_field.rb b/app/models/custom_field.rbindex ef07583c930..7b86c4c97c9 100644--- a/app/models/custom_field.rb+++ b/app/models/custom_field.rb@@ -38,15 +38,15 @@ class CustomField < ApplicationRecordhas_many :custom_options,-> { order(position: :asc) },dependent: :delete_all,- inverse_of: 'custom_field'+ inverse_of: "custom_field"accepts_nested_attributes_for :custom_optionsacts_as_list scope: [:type]validates :field_format, presence: truevalidates :custom_options,- presence: { message: ->(*) { I18n.t(:'activerecord.errors.models.custom_field.at_least_one_custom_option') } },- if: ->(*) { field_format == 'list' }+ presence: { message: ->(*) { I18n.t(:"activerecord.errors.models.custom_field.at_least_one_custom_option") } },+ if: ->(*) { field_format == "list" }validates :name, presence: true, length: { maximum: 256 }validate :uniqueness_of_name_with_scope@@ -127,11 +127,11 @@ class CustomField < ApplicationRecorddef possible_values_options(obj = nil)case field_format- when 'user'+ when "user"possible_user_values_options(obj)- when 'version'+ when "version"possible_version_values_options(obj)- when 'list'+ when "list"possible_list_values_optionselsepossible_values@@ -153,9 +153,9 @@ class CustomField < ApplicationRecord# You MUST NOT pass a customizable if this CF has any other formatdef possible_values(obj = nil)case field_format- when 'user', 'version'+ when "user", "version"possible_values_options(obj).map(&:last)- when 'list'+ when "list"custom_optionselseread_attribute(:possible_values)@@ -184,27 +184,27 @@ class CustomField < ApplicationRecordreturn if value.blank?case field_format- when 'string', 'text', 'list'+ when "string", "text", "list"value- when 'date'+ when "date"beginvalue.to_daterescue StandardErrornilend- when 'bool'+ when "bool"ActiveRecord::Type::Boolean.new.cast(value)- when 'int'+ when "int"value.to_i- when 'float'+ when "float"value.to_f- when 'user', 'version'+ when "user", "version"field_format.classify.constantize.find_by(id: value.to_i)endenddef <=>(other)- if type == 'WorkPackageCustomField'+ if type == "WorkPackageCustomField"name.downcase <=> other.name.downcaseelseposition <=> other.positiondiff --git a/app/models/custom_value.rb b/app/models/custom_value.rbindex ea8fde49706..0e331d84f54 100644--- a/app/models/custom_value.rb+++ b/app/models/custom_value.rb@@ -58,7 +58,7 @@ class CustomValue < ApplicationRecorddef strategy@strategy ||= begin- format = custom_field&.field_format || 'empty'+ format = custom_field&.field_format || "empty"OpenProject::CustomFieldFormat.find_by_name(format).formatter.new(self) # rubocop:disable Rails/DynamicFindByendenddiff --git a/app/models/project_custom_field_project_mapping.rb b/app/models/project_custom_field_project_mapping.rbindex 217e06eadd4..f2832d96a6d 100644--- a/app/models/project_custom_field_project_mapping.rb+++ b/app/models/project_custom_field_project_mapping.rb@@ -28,7 +28,7 @@class ProjectCustomFieldProjectMapping < ApplicationRecordbelongs_to :project- belongs_to :project_custom_field, class_name: 'ProjectCustomField', foreign_key: 'custom_field_id',+ belongs_to :project_custom_field, class_name: "ProjectCustomField", foreign_key: "custom_field_id",inverse_of: :project_custom_field_project_mappingsvalidates :custom_field_id, uniqueness: { scope: :project_id }diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rbindex 41441fe6cc7..9fdd53b0b0c 100644--- a/app/models/projects/acts_as_customizable_patches.rb+++ b/app/models/projects/acts_as_customizable_patches.rb@@ -35,9 +35,9 @@ module Projects::ActsAsCustomizablePatches# not needed for now, but might be relevant if we want to have edit dialogs just for one custom fieldincluded do- has_many :project_custom_field_project_mappings, class_name: 'ProjectCustomFieldProjectMapping', foreign_key: :project_id,+ has_many :project_custom_field_project_mappings, class_name: "ProjectCustomFieldProjectMapping", foreign_key: :project_id,dependent: :destroy, inverse_of: :project- has_many :project_custom_fields, through: :project_custom_field_project_mappings, class_name: 'ProjectCustomField'+ has_many :project_custom_fields, through: :project_custom_field_project_mappings, class_name: "ProjectCustomField"# we need to reset the query_available_custom_fields_on_global_level already after validation# as the update service just calls .valid? and returns if invalid@@ -86,7 +86,7 @@ module Projects::ActsAsCustomizablePatchesdef reject_section_scoped_validation_for_creationif _limit_custom_fields_validation_to_section_id.present?raise ArgumentError,- 'Section scoped validation is not supported for project creation, only for project updates'+ "Section scoped validation is not supported for project creation, only for project updates"endenddiff --git a/config/environments/development.rb b/config/environments/development.rbindex 4839e5f294d..a9ab75a41aa 100644--- a/config/environments/development.rb+++ b/config/environments/development.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'active_support/core_ext/integer/time'+require "active_support/core_ext/integer/time"Rails.application.configure do# Settings specified here will take precedence over those in config/application.rb.@@ -37,7 +37,7 @@ Rails.application.configure doconfig.enable_reloading = true# Do not eager load code on boot by default.- config.eager_load = ENV['EAGER_LOAD'].present?+ config.eager_load = ENV["EAGER_LOAD"].present?# Asynchronous file watcherconfig.file_watcher = ActiveSupport::EventedFileUpdateChecker@@ -111,12 +111,12 @@ Rails.application.configure doconfig.action_mailer.delivery_method = :letter_opener_web# Set email preview locations to rspec- config.action_mailer.preview_paths << Rails.root.join('spec/mailers/previews')+ config.action_mailer.preview_paths << Rails.root.join("spec/mailers/previews")- config.hosts << 'bs-local.com' if ENV['OPENPROJECT_DISABLE_DEV_ASSET_PROXY'].present?+ config.hosts << "bs-local.com" if ENV["OPENPROJECT_DISABLE_DEV_ASSET_PROXY"].present?- if ENV['OPENPROJECT_DEV_EXTRA_HOSTS'].present?- config.hosts.push(*ENV['OPENPROJECT_DEV_EXTRA_HOSTS'].split(','))+ if ENV["OPENPROJECT_DEV_EXTRA_HOSTS"].present?+ config.hosts.push(*ENV["OPENPROJECT_DEV_EXTRA_HOSTS"].split(","))endenddiff --git a/db/migrate/20231031133334_create_project_custom_field_project_mappings.rb b/db/migrate/20231031133334_create_project_custom_field_project_mappings.rbindex 42462529531..ff9580a45df 100644--- a/db/migrate/20231031133334_create_project_custom_field_project_mappings.rb+++ b/db/migrate/20231031133334_create_project_custom_field_project_mappings.rb@@ -2,7 +2,7 @@ class CreateProjectCustomFieldProjectMappings < ActiveRecord::Migration[7.0]def upcreate_table :project_custom_field_project_mappings do |t|t.references :custom_field, foreign_key: true, index: {- name: 'index_project_cf_project_mappings_on_custom_field_id'+ name: "index_project_cf_project_mappings_on_custom_field_id"}t.references :project, foreign_key: truediff --git a/db/migrate/20240208100316_enable_required_project_custom_fields_in_all_projects.rb b/db/migrate/20240208100316_enable_required_project_custom_fields_in_all_projects.rbindex 9168d770fb8..8ac7940f7b7 100644--- a/db/migrate/20240208100316_enable_required_project_custom_fields_in_all_projects.rb+++ b/db/migrate/20240208100316_enable_required_project_custom_fields_in_all_projects.rb@@ -8,7 +8,7 @@ class EnableRequiredProjectCustomFieldsInAllProjects < ActiveRecord::Migration[7missing_custom_field_attributes =Project.includes(:project_custom_field_project_mappings)- .pluck(:id, 'project_custom_field_project_mappings.custom_field_id')+ .pluck(:id, "project_custom_field_project_mappings.custom_field_id").group_by(&:first).transform_values { |values| values.map(&:last) }.reduce([]) do |acc, (project_id, custom_field_ids)|diff --git a/lib/api/v3/principals/principals_api.rb b/lib/api/v3/principals/principals_api.rbindex 8ddaf82484f..a939525ae7c 100644--- a/lib/api/v3/principals/principals_api.rb+++ b/lib/api/v3/principals/principals_api.rb@@ -37,9 +37,9 @@ module API.mountparams do- requires :id, desc: 'Principal ID'+ requires :id, desc: "Principal ID"end- route_param :id, type: Integer, desc: 'Principal ID' do+ route_param :id, type: Integer, desc: "Principal ID" doafter_validation do@principal = Principal.visible.find(params[:id])enddiff --git a/lib/open_project/events.rb b/lib/open_project/events.rbindex edf7d3eefee..47f08cceade 100644--- a/lib/open_project/events.rb+++ b/lib/open_project/events.rb@@ -42,15 +42,15 @@ module OpenProjectAGGREGATED_NEWS_JOURNAL_READY = "aggregated_news_journal_ready".freezeAGGREGATED_MESSAGE_JOURNAL_READY = "aggregated_message_journal_ready".freeze- ATTACHMENT_CREATED = 'attachment_created'.freeze+ ATTACHMENT_CREATED = "attachment_created".freeze- JOURNAL_CREATED = 'journal_created'.freeze+ JOURNAL_CREATED = "journal_created".freeze- MEMBER_CREATED = 'member_created'.freeze- MEMBER_UPDATED = 'member_updated'.freeze- MEMBER_DESTROYED = 'member_destroyed'.freeze+ MEMBER_CREATED = "member_created".freeze+ MEMBER_UPDATED = "member_updated".freeze+ MEMBER_DESTROYED = "member_destroyed".freeze- OAUTH_CLIENT_TOKEN_CREATED = 'oauth_client_token_created'.freeze+ OAUTH_CLIENT_TOKEN_CREATED = "oauth_client_token_created".freezeTIME_ENTRY_CREATED = "time_entry_created".freeze@@ -72,9 +72,9 @@ module OpenProjectROLE_UPDATED = "role_updated".freezeROLE_DESTROYED = "role_destroyed".freeze- WATCHER_ADDED = 'watcher_added'.freeze- WATCHER_DESTROYED = 'watcher_destroyed'.freeze+ WATCHER_ADDED = "watcher_added".freeze+ WATCHER_DESTROYED = "watcher_destroyed".freeze- WORK_PACKAGE_SHARED = 'work_package_shared'.freeze+ WORK_PACKAGE_SHARED = "work_package_shared".freezeendenddiff --git a/lib/open_project/static/links.rb b/lib/open_project/static/links.rbindex b488b858a60..3bde27c86b6 100644--- a/lib/open_project/static/links.rb+++ b/lib/open_project/static/links.rb@@ -276,10 +276,10 @@ module OpenProjecthref: "https://apps.nextcloud.com/apps/integration_openproject"},one_drive_oauth_application: {- href: 'https://portal.azure.com/'+ href: "https://portal.azure.com/"},troubleshooting: {- href: 'https://www.openproject.org/docs/user-guide/file-management/nextcloud-integration/#possible-errors-and-troubleshooting'+ href: "https://www.openproject.org/docs/user-guide/file-management/nextcloud-integration/#possible-errors-and-troubleshooting"}},ical_docs: {diff --git a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rbindex a98e168399a..16aaf44125a 100644--- a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb+++ b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb@@ -77,8 +77,8 @@ module Redminedef custom_fields=(values)values_to_hash = values.inject({}) do |hash, v|v = v.stringify_keys- if v['id'] && v.has_key?('value')- hash[v['id']] = v['value']+ if v["id"] && v.has_key?("value")+ hash[v["id"]] = v["value"]endhashenddiff --git a/modules/overviews/config/routes.rb b/modules/overviews/config/routes.rbindex 755569db7e3..846ce8d17a1 100644--- a/modules/overviews/config/routes.rb+++ b/modules/overviews/config/routes.rb@@ -1,11 +1,11 @@Rails.application.routes.draw doconstraints(project_id: Regexp.new("(?!(#{Project::RESERVED_IDENTIFIERS.join('|')})$)(\\w|-)+"), format: :html) do- get 'projects/:project_id',+ get "projects/:project_id",to: "overviews/overviews#show",as: :project_overview- get 'projects/:project_id/project_custom_fields_sidebar', to: "overviews/overviews#project_custom_fields_sidebar", as: :project_custom_fields_sidebar- get 'projects/:project_id/project_custom_field_section_dialog/:section_id', to: "overviews/overviews#project_custom_field_section_dialog",+ get "projects/:project_id/project_custom_fields_sidebar", to: "overviews/overviews#project_custom_fields_sidebar", as: :project_custom_fields_sidebar+ get "projects/:project_id/project_custom_field_section_dialog/:section_id", to: "overviews/overviews#project_custom_field_section_dialog",as: :project_custom_field_section_dialog- put 'projects/:project_id/update_project_custom_values/:section_id', to: "overviews/overviews#update_project_custom_values", as: :update_project_custom_values+ put "projects/:project_id/update_project_custom_values/:section_id", to: "overviews/overviews#update_project_custom_values", as: :update_project_custom_valuesendenddiff --git a/modules/overviews/lib/overviews/engine.rb b/modules/overviews/lib/overviews/engine.rbindex c738f08b13a..dbc9f9392e4 100644--- a/modules/overviews/lib/overviews/engine.rb+++ b/modules/overviews/lib/overviews/engine.rb@@ -32,42 +32,42 @@ module Overviewsinclude OpenProject::Plugins::ActsAsOpEngine- initializer 'overviews.menu' do+ initializer "overviews.menu" do::Redmine::MenuManager.map(:project_menu) do |menu|menu.push(:overview,- { controller: '/overviews/overviews', action: 'show' },- caption: :'overviews.label',+ { controller: "/overviews/overviews", action: "show" },+ caption: :"overviews.label",first: true,- icon: 'info1')+ icon: "info1")endend- initializer 'overviews.permissions' do+ initializer "overviews.permissions" doRails.application.reloader.to_prepare doOpenProject::AccessControl.permission(:view_project).controller_actions.push(- 'overviews/overviews/show',- 'overviews/overviews/project_custom_fields_sidebar'+ "overviews/overviews/show",+ "overviews/overviews/project_custom_fields_sidebar")OpenProject::AccessControl.permission(:edit_project).controller_actions.push(- 'overviews/overviews/project_custom_field_section_dialog',- 'overviews/overviews/update_project_custom_values'+ "overviews/overviews/project_custom_field_section_dialog",+ "overviews/overviews/update_project_custom_values")OpenProject::AccessControl.permission(:view_work_packages).controller_actions- .push('overviews/overviews/show')+ .push("overviews/overviews/show")OpenProject::AccessControl.map do |ac_map|ac_map.project_module nil do |map|map.permission :manage_overview,- { 'overviews/overviews':+ { "overviews/overviews":[- 'show'+ "show"] },permissible_on: :project,require: :member@@ -76,10 +76,10 @@ module Overviewsendend- initializer 'overviews.conversion' do- require Rails.root.join('config/constants/ar_to_api_conversions')+ initializer "overviews.conversion" do+ require Rails.root.join("config/constants/ar_to_api_conversions")- Constants::ARToAPIConversions.add('grids/overview': 'grid')+ Constants::ARToAPIConversions.add("grids/overview": "grid")endconfig.to_prepare dodiff --git a/modules/storages/app/common/storages/peripherals/nextcloud.rb b/modules/storages/app/common/storages/peripherals/nextcloud.rbindex d59f4d003d3..8c8a0c33599 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud.rb@@ -30,8 +30,8 @@module Storagesmodule Peripherals- Nextcloud = Dry::Container::Namespace.new('nextcloud') do- namespace('queries') do+ Nextcloud = Dry::Container::Namespace.new("nextcloud") do+ namespace("queries") doregister(:auth_check, StorageInteraction::Nextcloud::AuthCheckQuery)register(:download_link, StorageInteraction::Nextcloud::DownloadLinkQuery)register(:file_ids, StorageInteraction::Nextcloud::FileIdsQuery)@@ -46,7 +46,7 @@ module Storagesregister(:open_storage, StorageInteraction::Nextcloud::OpenStorageQuery)end- namespace('commands') do+ namespace("commands") doregister(:add_user_to_group, StorageInteraction::Nextcloud::AddUserToGroupCommand)register(:copy_template_folder, StorageInteraction::Nextcloud::CopyTemplateFolderCommand)register(:create_folder, StorageInteraction::Nextcloud::CreateFolderCommand)@@ -57,11 +57,11 @@ module Storagesregister(:set_permissions, StorageInteraction::Nextcloud::SetPermissionsCommand)end- namespace('contracts') do+ namespace("contracts") doregister(:storage, ::Storages::Storages::NextcloudContract)end- namespace('models') do+ namespace("models") doregister(:managed_folder_identifier, ManagedFolderIdentifier::Nextcloud)endenddiff --git a/modules/storages/app/common/storages/peripherals/one_drive.rb b/modules/storages/app/common/storages/peripherals/one_drive.rbindex 5ec1cc2975a..0d9b6faef0b 100644--- a/modules/storages/app/common/storages/peripherals/one_drive.rb+++ b/modules/storages/app/common/storages/peripherals/one_drive.rb@@ -30,8 +30,8 @@module Storagesmodule Peripherals- OneDrive = Dry::Container::Namespace.new('one_drive') do- namespace('queries') do+ OneDrive = Dry::Container::Namespace.new("one_drive") do+ namespace("queries") doregister(:auth_check, StorageInteraction::OneDrive::AuthCheckQuery)register(:download_link, StorageInteraction::OneDrive::DownloadLinkQuery)register(:files, StorageInteraction::OneDrive::FilesQuery)@@ -43,18 +43,18 @@ module Storagesregister(:upload_link, StorageInteraction::OneDrive::UploadLinkQuery)end- namespace('commands') do+ namespace("commands") doregister(:create_folder, StorageInteraction::OneDrive::CreateFolderCommand)register(:delete_folder, StorageInteraction::OneDrive::DeleteFolderCommand)register(:rename_file, StorageInteraction::OneDrive::RenameFileCommand)register(:set_permissions, StorageInteraction::OneDrive::SetPermissionsCommand)end- namespace('contracts') do+ namespace("contracts") doregister(:storage, ::Storages::Storages::OneDriveContract)end- namespace('models') do+ namespace("models") doregister(:managed_folder_identifier, ManagedFolderIdentifier::OneDrive)endenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rbindex 0cf4f57d18a..90a18bf3ca7 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb@@ -47,7 +47,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudresponse = OpenProject.httpx.basic_auth(@username, @password)- .with(headers: { 'OCS-APIRequest' => 'true' })+ .with(headers: { "OCS-APIRequest" => "true" }).get(Util.join_uri_path(@uri, "ocs/v1.php/cloud/groups", CGI.escapeURIComponent(group)))error_data = Storages::StorageErrorData.new(source: self.class, payload: response)@@ -55,19 +55,19 @@ module Storages::Peripherals::StorageInteraction::Nextcloudcase responsein { status: 200..299 }group_users = Nokogiri::XML(response.body.to_s)- .xpath('/ocs/data/users/element')+ .xpath("/ocs/data/users/element").map(&:text)ServiceResult.success(result: group_users)in { status: 405 }- Util.error(:not_allowed, 'Outbound request method not allowed', error_data)+ Util.error(:not_allowed, "Outbound request method not allowed", error_data)in { status: 401 }- Util.error(:unauthorized, 'Outbound request not authorized', error_data)+ Util.error(:unauthorized, "Outbound request not authorized", error_data)in { status: 404 }- Util.error(:not_found, 'Outbound request destination not found', error_data)+ Util.error(:not_found, "Outbound request destination not found", error_data)in { status: 409 }Util.error(:conflict, error_text_from_response(response), error_data)else- Util.error(:error, 'Outbound request failed', error_data)+ Util.error(:error, "Outbound request failed", error_data)endenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/create_folder_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/create_folder_command.rbindex 1bf71362f34..436b40364fa 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/create_folder_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/create_folder_command.rb@@ -66,7 +66,7 @@ module Storagescase responsein { status: 200..299 }ServiceResult.success(result: file_info_for(MultiJson.load(response.body, symbolize_keys: true)),- message: 'Folder was successfully created.')+ message: "Folder was successfully created.")in { status: 404 }ServiceResult.failure(result: :not_found,errors: ::Storages::StorageError.new(code: :not_found, data:))@@ -101,7 +101,7 @@ module Storages{name: folder_path,folder: {},- '@microsoft.graph.conflictBehavior' => "fail"+ "@microsoft.graph.conflictBehavior" => "fail"}.to_jsonenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rbindex 596d009d78e..8a6f3a091b8 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb@@ -49,7 +49,7 @@ module Storages@uri,uri_path_for(file_link.origin_id)),- headers: { 'Authorization' => "Bearer #{token.access_token}" }+ headers: { "Authorization" => "Bearer #{token.access_token}" })handle_errors(response)@@ -61,7 +61,7 @@ module Storagesdef handle_errors(response)case responsein { status: 300..399 }- ServiceResult.success(result: response.headers['Location'])+ ServiceResult.success(result: response.headers["Location"])in { status: 404 }ServiceResult.failure(result: :not_found,errors: ::Storages::StorageError.new(code: :not_found, data: response))diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query.rbindex af82c7c2964..efce5928626 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query.rb@@ -108,7 +108,7 @@ module Storages::Peripherals::StorageInteraction::OneDriveresponse = http.get(Util.join_uri_path(@storage.uri, "#{uri_path}?$select=id,name,parentReference"))handle_responses(response).map do |json|if folder.root?- { '/' => Storages::StorageFileInfo.from_id(json[:id]) }+ { "/" => Storages::StorageFileInfo.from_id(json[:id]) }elseparse_drive_item_info(json)[:entry]enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command.rbindex b952e054411..49e4721aac4 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command.rb@@ -124,8 +124,8 @@ module Storagespermission[:id]end.curry- write_permissions = permission_set.filter_map(&filter.call('write'))- read_permissions = permission_set.filter_map(&filter.call('read'))+ write_permissions = permission_set.filter_map(&filter.call("write"))+ read_permissions = permission_set.filter_map(&filter.call("read")){ read: read_permissions, write: write_permissions }enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rbindex 529dd2632b4..fae746357b7 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb@@ -43,12 +43,12 @@ module Storagesenddef call(user:, data:)- folder, filename = data.slice('parent', 'file_name').values+ folder, filename = data.slice("parent", "file_name").valuesUtil.using_user_token(@storage, user) do |token|response = OpenProject.httpx- .with(headers: { 'Authorization' => "Bearer #{token.access_token}",- 'Content-Type' => 'application/json' })+ .with(headers: { "Authorization" => "Bearer #{token.access_token}",+ "Content-Type" => "application/json" }).post(Util.join_uri_path(@uri, uri_path_for(folder, filename)),json: payload(filename)diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rbindex 159862dd869..93529fcba79 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb@@ -33,7 +33,7 @@ module Storages::Peripherals::StorageInteraction::OneDrive::Utilclass << selfdef mime_type(json)- json.dig(:file, :mimeType) || (json.key?(:folder) ? 'application/x-op-directory' : nil)+ json.dig(:file, :mimeType) || (json.key?(:folder) ? "application/x-op-directory" : nil)enddef using_user_token(storage, user, &)@@ -52,7 +52,7 @@ module Storages::Peripherals::StorageInteraction::OneDrive::Utilerrors: ::Storages::StorageError.new(code: :unauthorized,data: ::Storages::StorageErrorData.new(source: connection_manager),- log_message: 'Query could not be created! No access token found!'+ log_message: "Query could not be created! No access token found!"))end@@ -78,7 +78,7 @@ module Storages::Peripherals::StorageInteraction::OneDrive::Utiltoken_result = beginRails.cache.fetch("storage.#{storage.id}.access_token", expires_in: 50.minutes) do- ServiceResult.success(result: oauth_client.access_token!(scope: 'https://graph.microsoft.com/.default'))+ ServiceResult.success(result: oauth_client.access_token!(scope: "https://graph.microsoft.com/.default"))endrescue Rack::OAuth2::Client::Error => eServiceResult.failure(errors: ::Storages::StorageError.new(@@ -93,16 +93,16 @@ module Storages::Peripherals::StorageInteraction::OneDrive::Utilyield OpenProject.httpx.with(origin: storage.uri,headers: { authorization: "Bearer #{token.access_token}",accept: "application/json",- 'content-type': 'application/json' })+ "content-type": "application/json" })end,on_failure: ->(errors) { ServiceResult.failure(result: :unauthorized, errors:) })end- def extract_location(parent_reference, file_name = '')- location = parent_reference[:path].gsub(/.*root:/, '')+ def extract_location(parent_reference, file_name = "")+ location = parent_reference[:path].gsub(/.*root:/, "")- appendix = file_name.blank? ? '' : "/#{file_name}"+ appendix = file_name.blank? ? "" : "/#{file_name}"location.empty? ? "/#{file_name}" : "#{location}#{appendix}"endenddiff --git a/modules/storages/app/mailers/storages/storages_mailer.rb b/modules/storages/app/mailers/storages/storages_mailer.rbindex 50dbe4fcd1d..42088376911 100644--- a/modules/storages/app/mailers/storages/storages_mailer.rb+++ b/modules/storages/app/mailers/storages/storages_mailer.rb@@ -30,7 +30,7 @@module Storagesclass StoragesMailer < ApplicationMailer- layout 'mailer'+ layout "mailer"include MessagesHelperinclude MailNotificationHelper@@ -43,7 +43,7 @@ module Storages@storage = storage@reason = storage.health_reason@url = edit_admin_settings_storage_url(storage)- subject = I18n.t('mail.storages.health.unhealthy.subject', name: @storage.name)+ subject = I18n.t("mail.storages.health.unhealthy.subject", name: @storage.name)mail(to: admin.mail, subject:)end@@ -52,7 +52,7 @@ module Storages@storage = storage@reason = reason@url = edit_admin_settings_storage_url(storage)- subject = I18n.t('mail.storages.health.healthy.subject', name: @storage.name)+ subject = I18n.t("mail.storages.health.healthy.subject", name: @storage.name)mail(to: admin.mail, subject:)endenddiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex 66a57a4e999..fe961c49422 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -139,10 +139,10 @@ module OpenProject::Storagesdependencies: %i[view_file_links],contract_actions: { file_links: %i[manage] }permission :manage_storages_in_project,- { 'storages/admin/project_storages': %i[index members new+ { "storages/admin/project_storages": %i[index members newedit update create oauth_access_grantdestroy destroy_info set_permissions],- 'storages/project_settings/project_storage_members': %i[index] },+ "storages/project_settings/project_storage_members": %i[index] },permissible_on: :project,dependencies: %i[]@@ -179,14 +179,14 @@ module OpenProject::Storages(prj_storage.project_folder_automatic? && !u.allowed_in_project?(:read_files, prj))next if hide_from_menu- icon = storage.provider_type_nextcloud? ? 'nextcloud-circle' : 'hosting'+ icon = storage.provider_type_nextcloud? ? "nextcloud-circle" : "hosting"menu.push(:"storage_#{storage.id}",prj_storage.open_with_connection_ensured,caption: storage.name,before: :members,icon:,- icon_after: 'external-link',+ icon_after: "external-link",skip_permissions_check: true)end@@ -302,12 +302,12 @@ module OpenProject::Storagesadd_cron_jobs do{- 'Storages::CleanupUncontaineredFileLinksJob': {+ "Storages::CleanupUncontaineredFileLinksJob": {cron: "06 22 * * *",class: ::Storages::CleanupUncontaineredFileLinksJob.name},- 'Storages::ManageNextcloudIntegrationJob': {+ "Storages::ManageNextcloudIntegrationJob": {cron: "1 * * * *",class: ::Storages::ManageNextcloudIntegrationJob.name}diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rbindex b2df40f1df6..53225148061 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb@@ -28,7 +28,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"require_module_spec_helperRSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery, :webmock do@@ -36,22 +36,22 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,let(:user) { create(:user) }let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }- let(:folder) { Storages::Peripherals::ParentFolder.new('/') }+ let(:folder) { Storages::Peripherals::ParentFolder.new("/") }let(:auth_strategy) doStorages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)end- describe '#call' do- it 'responds with correct parameters' do+ describe "#call" do+ it "responds with correct parameters" doexpect(described_class).to respond_to(:call)method = described_class.method(:call)expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq auth_strategy], %i[keyreq folder])end- context 'with outbound requests successful' do- context 'with parent folder being root', vcr: 'one_drive/files_query_root' do- it 'returns a StorageFiles object for root' do+ context "with outbound requests successful" do+ context "with parent folder being root", vcr: "one_drive/files_query_root" do+ it "returns a StorageFiles object for root" dostorage_files = described_class.call(storage:, auth_strategy:, folder:).resultexpect(storage_files).to be_a(Storages::StorageFiles)@@ -59,115 +59,115 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,expect(storage_files.parent.name).to eq("Root")expect(storage_files.files.count).to eq(3)expect(storage_files.files.map(&:to_h).first)- .to eq({ id: '01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR',- name: 'Folder',+ .to eq({ id: "01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR",+ name: "Folder",size: 260500,- created_at: Time.zone.parse('2023-09-26T14:38:50Z'),- created_by_name: 'Eric Schubert',- last_modified_at: Time.zone.parse('2023-09-26T14:38:50Z'),- last_modified_by_name: 'Eric Schubert',- location: '/Folder',- mime_type: 'application/x-op-directory',+ created_at: Time.zone.parse("2023-09-26T14:38:50Z"),+ created_by_name: "Eric Schubert",+ last_modified_at: Time.zone.parse("2023-09-26T14:38:50Z"),+ last_modified_by_name: "Eric Schubert",+ location: "/Folder",+ mime_type: "application/x-op-directory",permissions: %i[readable writeable] })endend- context 'with a given parent folder', vcr: 'one_drive/files_query_parent_folder' do- let(:folder) { Storages::Peripherals::ParentFolder.new('/Folder/Subfolder') }+ context "with a given parent folder", vcr: "one_drive/files_query_parent_folder" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Subfolder") }subject dodescribed_class.call(storage:, auth_strategy:, folder:).resultend# rubocop:disable RSpec/ExampleLength- it 'returns the files content' do+ it "returns the files content" doexpect(subject.files.map(&:to_h)).to eq([{- id: '01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA',- name: 'NextcloudHub.md',+ id: "01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA",+ name: "NextcloudHub.md",size: 1095,- created_at: '2023-09-26T14:45:25Z',- created_by_name: 'Eric Schubert',- last_modified_at: '2023-09-26T14:46:13Z',- last_modified_by_name: 'Eric Schubert',- location: '/Folder/Subfolder/NextcloudHub.md',- mime_type: 'application/octet-stream',+ created_at: "2023-09-26T14:45:25Z",+ created_by_name: "Eric Schubert",+ last_modified_at: "2023-09-26T14:46:13Z",+ last_modified_by_name: "Eric Schubert",+ location: "/Folder/Subfolder/NextcloudHub.md",+ mime_type: "application/octet-stream",permissions: %i[readable writeable]}, {- id: '01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ',- name: 'test.txt',+ id: "01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ",+ name: "test.txt",size: 28,- created_at: '2023-09-26T14:45:23Z',- created_by_name: 'Eric Schubert',- last_modified_at: '2023-09-26T14:45:45Z',- last_modified_by_name: 'Eric Schubert',- location: '/Folder/Subfolder/test.txt',- mime_type: 'text/plain',+ created_at: "2023-09-26T14:45:23Z",+ created_by_name: "Eric Schubert",+ last_modified_at: "2023-09-26T14:45:45Z",+ last_modified_by_name: "Eric Schubert",+ location: "/Folder/Subfolder/test.txt",+ mime_type: "text/plain",permissions: %i[readable writeable]}])end# rubocop:enable RSpec/ExampleLength- it 'returns ancestors with a forged id' do+ it "returns ancestors with a forged id" doexpect(subject.ancestors.map { |a| { id: a.id, name: a.name, location: a.location } }).to eq([{- id: 'a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d',- name: 'Root',- location: '/'+ id: "a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d",+ name: "Root",+ location: "/"}, {- id: '74ccd43303847f2655300641a934959cdb11689ce171aa0f00faa92917fbd340',- name: 'Folder',- location: '/Folder'+ id: "74ccd43303847f2655300641a934959cdb11689ce171aa0f00faa92917fbd340",+ name: "Folder",+ location: "/Folder"}])end- it 'returns the parent itself' do- expect(subject.parent.id).to eq('01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG')- expect(subject.parent.name).to eq('Subfolder')- expect(subject.parent.location).to eq('/Folder/Subfolder')+ it "returns the parent itself" do+ expect(subject.parent.id).to eq("01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG")+ expect(subject.parent.name).to eq("Subfolder")+ expect(subject.parent.location).to eq("/Folder/Subfolder")endend- context 'with parent folder being empty', vcr: 'one_drive/files_query_empty_folder' do- let(:folder) { Storages::Peripherals::ParentFolder.new('/Folder with spaces/very empty folder') }+ context "with parent folder being empty", vcr: "one_drive/files_query_empty_folder" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder with spaces/very empty folder") }- it 'returns an empty StorageFiles object with parent and ancestors' do+ it "returns an empty StorageFiles object with parent and ancestors" dostorage_files = described_class.call(storage:, auth_strategy:, folder:).resultexpect(storage_files).to be_a(Storages::StorageFiles)expect(storage_files.files).to be_empty# in an empty folder the parent id cannot be retrieved, hence the parent id will get forged- expect(storage_files.parent.id).to eq('01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H')+ expect(storage_files.parent.id).to eq("01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H")endend- context 'with a path full of umlauts', vcr: 'one_drive/files_query_umlauts' do- let(:folder) { Storages::Peripherals::ParentFolder.new('/Folder/Ümlæûts') }+ context "with a path full of umlauts", vcr: "one_drive/files_query_umlauts" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Ümlæûts") }- it 'returns the correct StorageFiles object' do+ it "returns the correct StorageFiles object" dostorage_files = described_class.call(storage:, auth_strategy:, folder:).resultexpect(storage_files).to be_a(Storages::StorageFiles)- expect(storage_files.parent.id).to eq('01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB')- expect(storage_files.parent.name).to eq('Ümlæûts')- expect(storage_files.parent.location).to eq('/Folder/Ümlæûts')+ expect(storage_files.parent.id).to eq("01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB")+ expect(storage_files.parent.name).to eq("Ümlæûts")+ expect(storage_files.parent.location).to eq("/Folder/Ümlæûts")expect(storage_files.files.map(&:to_h)).to eq([{- id: '01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE',- name: 'Anrüchiges deutsches Dokument.docx',+ id: "01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE",+ name: "Anrüchiges deutsches Dokument.docx",size: 18007,- created_at: '2023-10-09T15:26:45Z',- created_by_name: 'Eric Schubert',- last_modified_at: '2023-10-09T15:27:25Z',- last_modified_by_name: 'Eric Schubert',- location: '/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx',- mime_type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',+ created_at: "2023-10-09T15:26:45Z",+ created_by_name: "Eric Schubert",+ last_modified_at: "2023-10-09T15:27:25Z",+ last_modified_by_name: "Eric Schubert",+ location: "/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx",+ mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",permissions: %i[readable writeable]}])@@ -175,10 +175,10 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,endend- context 'with not existent parent folder', vcr: 'one_drive/files_query_invalid_parent' do- let(:folder) { Storages::Peripherals::ParentFolder.new('/I/just/made/that/up') }+ context "with not existent parent folder", vcr: "one_drive/files_query_invalid_parent" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }- it 'must return not found' do+ it "must return not found" doresult = described_class.call(storage:, auth_strategy:, folder:)expect(result).to be_failureexpect(result.error_source).to be_a(described_class)diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query_spec.rbindex 7a545119bf1..a19b6228469 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/folder_files_file_ids_deep_query_spec.rb@@ -28,7 +28,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"require_module_spec_helperRSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FolderFilesFileIdsDeepQuery, :webmock do@@ -36,73 +36,73 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FolderFilesFlet(:user) { create(:user) }let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }- let(:folder) { Storages::Peripherals::ParentFolder.new('/') }+ let(:folder) { Storages::Peripherals::ParentFolder.new("/") }- describe '#call' do- it 'responds with correct parameters' do+ describe "#call" do+ it "responds with correct parameters" doexpect(described_class).to respond_to(:call)method = described_class.method(:call)expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq folder])end- context 'with outbound requests successful' do+ context "with outbound requests successful" dosubject dodescribed_class.call(storage:, folder:).resultend- context 'with parent folder being root', vcr: 'one_drive/folder_files_file_ids_deep_query_root' do- it 'returns the file id dictionary' do+ context "with parent folder being root", vcr: "one_drive/folder_files_file_ids_deep_query_root" do+ it "returns the file id dictionary" doexpect(subject.transform_values(&:id)).to eq({- '/' => '01AZJL5PN6Y2GOVW7725BZO354PWSELRRZ',- '/Folder with spaces' => '01AZJL5PKU2WV3U3RKKFF2A7ZCWVBXRTEU',- '/Folder with spaces/very empty folder' => '01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H',- '/Folder with spaces/wordle1.png' => '01AZJL5PPMSBBO3R2BIZHJFCELSW3RP7GN',- '/Folder with spaces/wordle2.png' => '01AZJL5PIIFUD6A765KBAIAEMYACAFB2WP',- '/Folder with spaces/wordle3.png' => '01AZJL5PL4AUJEU43CQZFJKN7BQPRP3BLF',- '/Folder' => '01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR',- '/Folder/Images' => '01AZJL5PMIF7ND3KH6FVDLZYP3E36ERFGI',- '/Folder/Subfolder' => '01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG',- '/Folder/Ümlæûts' => '01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB',- '/Folder/Document.docx' => '01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU',- '/Folder/Sheet.xlsx' => '01AZJL5PLB7SH7633RMBHIH6KVMQRU4RJS',- '/Folder/Images/der_laufende.jpeg' => '01AZJL5PLZFCARRQIDFJF36UL2WTLXTNSY',- '/Folder/Images/written_in_stone.webp' => '01AZJL5PLNCKWYI752YBHYYJ6RBFZWOZ46',- '/Folder/Subfolder/NextcloudHub.md' => '01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA',- '/Folder/Subfolder/test.txt' => '01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ',- '/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx' => '01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE',- '/Permissions Folder' => '01AZJL5PN3LVLHH2RSZZDJ6ZFAD3OWSGYB'+ "/" => "01AZJL5PN6Y2GOVW7725BZO354PWSELRRZ",+ "/Folder with spaces" => "01AZJL5PKU2WV3U3RKKFF2A7ZCWVBXRTEU",+ "/Folder with spaces/very empty folder" => "01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H",+ "/Folder with spaces/wordle1.png" => "01AZJL5PPMSBBO3R2BIZHJFCELSW3RP7GN",+ "/Folder with spaces/wordle2.png" => "01AZJL5PIIFUD6A765KBAIAEMYACAFB2WP",+ "/Folder with spaces/wordle3.png" => "01AZJL5PL4AUJEU43CQZFJKN7BQPRP3BLF",+ "/Folder" => "01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR",+ "/Folder/Images" => "01AZJL5PMIF7ND3KH6FVDLZYP3E36ERFGI",+ "/Folder/Subfolder" => "01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG",+ "/Folder/Ümlæûts" => "01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB",+ "/Folder/Document.docx" => "01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU",+ "/Folder/Sheet.xlsx" => "01AZJL5PLB7SH7633RMBHIH6KVMQRU4RJS",+ "/Folder/Images/der_laufende.jpeg" => "01AZJL5PLZFCARRQIDFJF36UL2WTLXTNSY",+ "/Folder/Images/written_in_stone.webp" => "01AZJL5PLNCKWYI752YBHYYJ6RBFZWOZ46",+ "/Folder/Subfolder/NextcloudHub.md" => "01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA",+ "/Folder/Subfolder/test.txt" => "01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ",+ "/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx" => "01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE",+ "/Permissions Folder" => "01AZJL5PN3LVLHH2RSZZDJ6ZFAD3OWSGYB"})endend- context 'with a given parent folder', vcr: 'one_drive/folder_files_file_ids_deep_query_parent_folder' do- let(:folder) { Storages::Peripherals::ParentFolder.new('01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR') }+ context "with a given parent folder", vcr: "one_drive/folder_files_file_ids_deep_query_parent_folder" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR") }- it 'returns the file id dictionary' do+ it "returns the file id dictionary" doexpect(subject.transform_values(&:id)).to eq({- '/Folder' => '01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR',- '/Folder/Images' => '01AZJL5PMIF7ND3KH6FVDLZYP3E36ERFGI',- '/Folder/Subfolder' => '01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG',- '/Folder/Ümlæûts' => '01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB',- '/Folder/Document.docx' => '01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU',- '/Folder/Sheet.xlsx' => '01AZJL5PLB7SH7633RMBHIH6KVMQRU4RJS',- '/Folder/Images/der_laufende.jpeg' => '01AZJL5PLZFCARRQIDFJF36UL2WTLXTNSY',- '/Folder/Images/written_in_stone.webp' => '01AZJL5PLNCKWYI752YBHYYJ6RBFZWOZ46',- '/Folder/Subfolder/NextcloudHub.md' => '01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA',- '/Folder/Subfolder/test.txt' => '01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ',- '/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx' => '01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE'+ "/Folder" => "01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR",+ "/Folder/Images" => "01AZJL5PMIF7ND3KH6FVDLZYP3E36ERFGI",+ "/Folder/Subfolder" => "01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG",+ "/Folder/Ümlæûts" => "01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB",+ "/Folder/Document.docx" => "01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU",+ "/Folder/Sheet.xlsx" => "01AZJL5PLB7SH7633RMBHIH6KVMQRU4RJS",+ "/Folder/Images/der_laufende.jpeg" => "01AZJL5PLZFCARRQIDFJF36UL2WTLXTNSY",+ "/Folder/Images/written_in_stone.webp" => "01AZJL5PLNCKWYI752YBHYYJ6RBFZWOZ46",+ "/Folder/Subfolder/NextcloudHub.md" => "01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA",+ "/Folder/Subfolder/test.txt" => "01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ",+ "/Folder/Ümlæûts/Anrüchiges deutsches Dokument.docx" => "01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE"})endendend- context 'with not existent parent folder', vcr: 'one_drive/folder_files_file_ids_deep_query_invalid_parent' do- let(:folder) { Storages::Peripherals::ParentFolder.new('/I/just/made/that/up') }+ context "with not existent parent folder", vcr: "one_drive/folder_files_file_ids_deep_query_invalid_parent" do+ let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }- it 'must return not found' do+ it "must return not found" doresult = described_class.call(storage:, folder:)expect(result).to be_failureexpect(result.error_source).to be_a(described_class)@@ -114,18 +114,18 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FolderFilesFendend- context 'with invalid oauth credentials', vcr: 'one_drive/folder_files_file_ids_deep_query_invalid_credentials' do+ context "with invalid oauth credentials", vcr: "one_drive/folder_files_file_ids_deep_query_invalid_credentials" dobefore dounauthorized_http = OpenProject.httpx.with(origin: storage.uri,headers: { authorization: "Bearer YouShallNotPass",accept: "application/json",- 'content-type': 'application/json' })+ "content-type": "application/json" })allow(Storages::Peripherals::StorageInteraction::OneDrive::Util).to receive(:using_admin_token).and_yield(unauthorized_http)end- it 'must return unauthorized' do+ it "must return unauthorized" doresult = described_class.call(storage:, folder:)expect(result).to be_failureexpect(result.error_source).to be_a(described_class)@@ -137,16 +137,16 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FolderFilesFendend- context 'with network errors' do+ context "with network errors" dobefore do- request = HTTPX::Request.new(:get, 'https://my.timeout.org/')- httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))+ request = HTTPX::Request.new(:get, "https://my.timeout.org/")+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, "Timeout happens", {}))allow(Storages::Peripherals::StorageInteraction::OneDrive::Util).to receive(:using_admin_token).and_yield(httpx_double)end- it 'must return an error with wrapped network error response' do+ it "must return an error with wrapped network error response" doerror = described_class.call(storage:, folder:)expect(error).to be_failureexpect(error.result).to eq(:error)diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rbindex 3d4ed0a8eef..5a99a1b35a8 100644--- a/modules/storages/spec/features/manage_project_storage_spec.rb+++ b/modules/storages/spec/features/manage_project_storage_spec.rb@@ -28,7 +28,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"require_module_spec_helper# Setup storages in Project -> Settings -> File Storages@@ -37,7 +37,7 @@ require_module_spec_helper# We decrease the notification polling interval because some portions of the JS code rely on something triggering# the Angular change detection. This is usually done by the notification polling, but we don't want to wait-RSpec.describe 'Activation of storages in projects', :js, :webmock, with_settings: { notifications_polling_interval: 1_000 } do+RSpec.describe "Activation of storages in projects", :js, :webmock, with_settings: { notifications_polling_interval: 1_000 } dolet(:user) { create(:user) }# The first page is the Project -> Settings -> General page, so we need# to provide the user with the edit_project permission in the role.@@ -67,11 +67,11 @@ RSpec.describe 'Activation of storages in projects', :js, :webmock, with_setting{ocs: {data: {- status: 'OK',+ status: "OK",statuscode: 200,id: 11,- name: 'Folder1',- path: 'files/Folder1',+ name: "Folder1",+ path: "files/Folder1",mtime: 1682509719,ctime: 0}@@ -99,146 +99,146 @@ RSpec.describe 'Activation of storages in projects', :js, :webmock, with_settinglogin_as userend- it 'adds, edits and removes storages to projects' do+ it "adds, edits and removes storages to projects" do# Go to Projects -> Settings -> File Storagesvisit project_settings_general_path(project)- page.click_link('File storages')+ page.click_link("File storages")# Check for an empty table in Project -> Settings -> File storages- expect(page).to have_title('File storages')+ expect(page).to have_title("File storages")expect(page).to have_current_path project_settings_project_storages_path(project)- expect(page).to have_text(I18n.t('storages.no_results'))- page.find('.toolbar .button--icon.icon-add').click+ expect(page).to have_text(I18n.t("storages.no_results"))+ page.find(".toolbar .button--icon.icon-add").click# Can cancel the creation of a new file storageexpect(page).to have_current_path new_project_settings_project_storage_path(project_id: project)- expect(page).to have_text('Add a file storage')- page.click_link('Cancel')+ expect(page).to have_text("Add a file storage")+ page.click_link("Cancel")expect(page).to have_current_path project_settings_project_storages_path(project)# Enable one file storage together with a project folder mode- page.find('.toolbar .button--icon.icon-add').click+ page.find(".toolbar .button--icon.icon-add").clickexpect(page).to have_current_path new_project_settings_project_storage_path(project_id: project)- expect(page).to have_text('Add a file storage')- expect(page).to have_select('storages_project_storage_storage_id',+ expect(page).to have_text("Add a file storage")+ expect(page).to have_select("storages_project_storage_storage_id",options: ["#{storage.name} (#{storage.short_provider_type})"])- page.click_button('Continue')+ page.click_button("Continue")# by default automatic have to be choosen if storage has automatic management enabledexpect(page).to have_checked_field("New folder with automatically managed permissions")- page.find_by_id('storages_project_storage_project_folder_mode_manual').click+ page.find_by_id("storages_project_storage_project_folder_mode_manual").click# Select project folder- expect(page).to have_text('No selected folder')- page.click_button('Select folder')+ expect(page).to have_text("No selected folder")+ page.click_button("Select folder")location_picker.expect_openusing_wait_time(20) dolocation_picker.wait_for_folder_loaded- location_picker.enter_folder('Folder1')+ location_picker.enter_folder("Folder1")location_picker.wait_for_folder_loadedendlocation_picker.confirm# Add storage- expect(page).to have_text('Folder1')- page.click_button('Add')+ expect(page).to have_text("Folder1")+ page.click_button("Add")# The list of enabled file storages should now contain Storage 1- expect(page).to have_text('File storages available in this project')+ expect(page).to have_text("File storages available in this project")expect(page).to have_text(storage.name)# Press Edit icon to change the project folder mode to inactive- page.find('.icon.icon-edit').click+ page.find(".icon.icon-edit").clickexpect(page).to have_current_path edit_project_settings_project_storage_path(project_id: project,id: Storages::ProjectStorage.last,- storages_project_storage: {project_folder_mode: 'manual'})- expect(page).to have_text('Edit the file storage to this project')- expect(page).to have_no_select('storages_project_storage_storage_id')+ storages_project_storage: {project_folder_mode: "manual"})+ expect(page).to have_text("Edit the file storage to this project")+ expect(page).to have_no_select("storages_project_storage_storage_id")expect(page).to have_text(storage.name)- expect(page).to have_checked_field('storages_project_storage_project_folder_mode_manual')- expect(page).to have_text('Folder1')+ expect(page).to have_checked_field("storages_project_storage_project_folder_mode_manual")+ expect(page).to have_text("Folder1")# Change the project folder mode to inactive, project folder is hidden but retained- page.find_by_id('storages_project_storage_project_folder_mode_inactive').click- expect(page).to have_no_text('Folder1')- page.click_button('Save')+ page.find_by_id("storages_project_storage_project_folder_mode_inactive").click+ expect(page).to have_no_text("Folder1")+ page.click_button("Save")# The list of enabled file storages should still contain Storage 1- expect(page).to have_text('File storages available in this project')+ expect(page).to have_text("File storages available in this project")expect(page).to have_text(storage.name)# Click Edit icon again but cancel the edit- page.find('.icon.icon-edit').click+ page.find(".icon.icon-edit").clickexpect(page).to have_current_path edit_project_settings_project_storage_path(project_id: project,id: Storages::ProjectStorage.last,- storages_project_storage: {project_folder_mode: 'inactive'})- expect(page).to have_text('Edit the file storage to this project')- page.click_link('Cancel')+ storages_project_storage: {project_folder_mode: "inactive"})+ expect(page).to have_text("Edit the file storage to this project")+ page.click_link("Cancel")expect(page).to have_current_path project_settings_project_storages_path(project)# Press Delete icon to remove the storage from the project- page.find('.icon.icon-delete').click+ page.find(".icon.icon-delete").click# Danger zone confirmation flow- expect(page).to have_css('.form--section-title', text: "DELETE FILE STORAGE")- expect(page).to have_css('.danger-zone--warning', text: "Deleting a file storage is an irreversible action.")- expect(page).to have_button('Delete', disabled: true)+ expect(page).to have_css(".form--section-title", text: "DELETE FILE STORAGE")+ expect(page).to have_css(".danger-zone--warning", text: "Deleting a file storage is an irreversible action.")+ expect(page).to have_button("Delete", disabled: true)# Cancel Confirmation- page.click_link('Cancel')+ page.click_link("Cancel")expect(page).to have_current_path project_settings_project_storages_path(project)- page.find('.icon.icon-delete').click+ page.find(".icon.icon-delete").click# Approve Confirmation- page.fill_in 'delete_confirmation', with: storage.name- page.click_button('Delete')+ page.fill_in "delete_confirmation", with: storage.name+ page.click_button("Delete")# List of ProjectStorages empty againexpect(page).to have_current_path project_settings_project_storages_path(project)- expect(page).to have_text(I18n.t('storages.no_results'))+ expect(page).to have_text(I18n.t("storages.no_results"))end- describe 'automatic project folder mode' do- context 'when the storage is not automatically managed' do+ describe "automatic project folder mode" do+ context "when the storage is not automatically managed" dolet(:oauth_application) { create(:oauth_application) }let(:storage) { create(:nextcloud_storage, :as_not_automatically_managed, oauth_application:) }let(:project_storage) { create(:project_storage, storage:, project:) }- it 'automatic option is not available' do+ it "automatic option is not available" dovisit edit_project_settings_project_storage_path(project_id: project, id: project_storage)- expect(page).to have_no_content('New folder with automatically managed permissions')+ expect(page).to have_no_content("New folder with automatically managed permissions")endend- context 'when the storage is automatically managed' do+ context "when the storage is automatically managed" dolet(:oauth_application) { create(:oauth_application) }let(:storage) { create(:nextcloud_storage, :as_automatically_managed, oauth_application:) }let(:project_storage) { create(:project_storage, storage:, project:) }- it 'automatic option is available' do+ it "automatic option is available" dovisit edit_project_settings_project_storage_path(project_id: project, id: project_storage)- expect(page).to have_content('New folder with automatically managed permissions')+ expect(page).to have_content("New folder with automatically managed permissions")endendend- describe 'configuration checks' do+ describe "configuration checks" dolet(:configured_storage) { storage }let!(:unconfigured_storage) { create(:nextcloud_storage) }- it 'excludes storages that are not configured correctly' do+ it "excludes storages that are not configured correctly" dovisit project_settings_project_storages_path(project)- page.find('.toolbar .button--icon.icon-add').click+ page.find(".toolbar .button--icon.icon-add").click- aggregate_failures 'select field options' do- expect(page).to have_select('storages_project_storage_storage_id',+ aggregate_failures "select field options" do+ expect(page).to have_select("storages_project_storage_storage_id",options: ["#{configured_storage.name} (#{configured_storage.short_provider_type})"])- expect(page).to have_no_select('storages_project_storage_storage_id',+ expect(page).to have_no_select("storages_project_storage_storage_id",options: ["#{unconfigured_storage.name} (#{unconfigured_storage.short_provider_type})"])endenddiff --git a/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb b/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rbindex 0a1e11a04b5..681b0ec25e4 100644--- a/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb@@ -28,10 +28,10 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"require_module_spec_helper-RSpec.describe 'API v3 file links resource' do+RSpec.describe "API v3 file links resource" doinclude API::V3::Utilities::PathHelperinclude UserPermissionsHelper@@ -93,8 +93,8 @@ RSpec.describe 'API v3 file links resource' dologin_as current_userend- describe 'POST /api/v3/file_links' do- let(:path) { '/api/v3/file_links' }+ describe "POST /api/v3/file_links" do+ let(:path) { "/api/v3/file_links" }let(:params) do{_type: "Collection",@@ -121,27 +121,27 @@ RSpec.describe 'API v3 file links resource' do}}},- build(:file_link_element, storage_url:, origin_id: '200001', origin_name: "file_name_1.txt")+ build(:file_link_element, storage_url:, origin_id: "200001", origin_name: "file_name_1.txt")]endbefore do- header 'Content-Type', 'application/json'+ header "Content-Type", "application/json"post path, params.to_jsonend- context 'when storage has been configured' do+ context "when storage has been configured" dolet(:storage_url) { storage.host }- context 'when all embedded file link elements are valid' do- it_behaves_like 'API V3 collection response', 2, 2, 'FileLink' do+ context "when all embedded file link elements are valid" do+ it_behaves_like "API V3 collection response", 2, 2, "FileLink" dolet(:elements) { Storages::FileLink.order(id: :asc) }let(:expected_status_code) { 201 }endit(- 'creates corresponding FileLink records and ' \- 'does not provide a link to the collection of created file links',+ "creates corresponding FileLink records and " \+ "does not provide a link to the collection of created file links",:aggregate_failures) doexpect(Storages::FileLink.count).to eq 2@@ -160,16 +160,16 @@ RSpec.describe 'API v3 file links resource' doendexpect(response.body).to be_json_eql(- 'urn:openproject-org:api:v3:file_links:no_link_provided'.to_json- ).at_path('_links/self/href')+ "urn:openproject-org:api:v3:file_links:no_link_provided".to_json+ ).at_path("_links/self/href")endendend- context 'when storage with such a host does not exist in OpenProject' do- let(:storage_url) { 'https://qweqwe.qweqwe' }+ context "when storage with such a host does not exist in OpenProject" do+ let(:storage_url) { "https://qweqwe.qweqwe" }- it 'responds with an appropriate error' do+ it "responds with an appropriate error" doexpect(JSON.parse(response.body)).to eq({ "_type" => "Error","errorIdentifier" => "urn:openproject-org:api:v3:errors:MultipleErrors",@@ -189,7 +189,7 @@ RSpec.describe 'API v3 file links resource' doendend- describe 'GET /api/v3/work_packages/:work_package_id/file_links' do+ describe "GET /api/v3/work_packages/:work_package_id/file_links" dolet(:path) { api_v3_paths.file_links(work_package.id) }before do@@ -199,13 +199,13 @@ RSpec.describe 'API v3 file links resource' doget pathend- context 'with all preconditions met (happy path)' do- it_behaves_like 'API V3 collection response', 1, 1, 'FileLink', 'Collection' do+ context "with all preconditions met (happy path)" do+ it_behaves_like "API V3 collection response", 1, 1, "FileLink", "Collection" dolet(:elements) { [file_link] }endend- context 'if user has not sufficient permissions' do+ context "if user has not sufficient permissions" dobefore(:all) doremove_permissions(current_user, :view_file_links)end@@ -214,54 +214,54 @@ RSpec.describe 'API v3 file links resource' doadd_permissions(current_user, :view_file_links)end- it_behaves_like 'API V3 collection response', 0, 0, 'FileLink', 'Collection' do+ it_behaves_like "API V3 collection response", 0, 0, "FileLink", "Collection" dolet(:elements) { [] }endend- context 'if storages module is deactivated for the work package\'s project' do- before(:all) { disable_module(project, 'storages') }- after(:all) { enable_module(project, 'storages') }+ context "if storages module is deactivated for the work package's project" do+ before(:all) { disable_module(project, "storages") }+ after(:all) { enable_module(project, "storages") }- it_behaves_like 'API V3 collection response', 0, 0, 'FileLink', 'Collection' do+ it_behaves_like "API V3 collection response", 0, 0, "FileLink", "Collection" dolet(:elements) { [] }endend- describe 'with filter by storage' do+ describe "with filter by storage" dolet!(:another_project_storage) { create(:project_storage, project:, storage: another_storage) }let(:path) { "#{api_v3_paths.file_links(work_package.id)}?filters=#{CGI.escape(filters.to_json)}" }- let(:filters) { [{ storage: { operator: '=', values: [storage_id] } }] }+ let(:filters) { [{ storage: { operator: "=", values: [storage_id] } }] }- context 'if filtered by one storage' do+ context "if filtered by one storage" dolet(:storage_id) { storage.id }- it_behaves_like 'API V3 collection response', 1, 1, 'FileLink', 'Collection' do+ it_behaves_like "API V3 collection response", 1, 1, "FileLink", "Collection" dolet(:elements) { [file_link] }endend- context 'if filtered by another storage' do+ context "if filtered by another storage" dolet(:storage_id) { another_storage.id }- it_behaves_like 'API V3 collection response', 1, 1, 'FileLink', 'Collection' do+ it_behaves_like "API V3 collection response", 1, 1, "FileLink", "Collection" do# has the now linked storage's file linkslet(:elements) { [file_link_of_another_storage] }endendend- context 'with bad query due to syntax error' do- let(:filters) { [{ storage: { operator: '#=', values: [storage.id] } }] }+ context "with bad query due to syntax error" do+ let(:filters) { [{ storage: { operator: "#=", values: [storage.id] } }] }let(:path) { "#{api_v3_paths.file_links(work_package.id)}?filters=#{CGI.escape(filters.to_json)}" }- it 'return a 400 HTTP error' do+ it "return a 400 HTTP error" doexpect(last_response.status).to be 400endendend- describe 'POST /api/v3/work_packages/:work_package_id/file_links' do+ describe "POST /api/v3/work_packages/:work_package_id/file_links" dolet(:path) { api_v3_paths.file_links(work_package.id) }let(:storage_url) { storage.host }let(:params) do@@ -305,19 +305,19 @@ RSpec.describe 'API v3 file links resource' doendbefore do- header 'Content-Type', 'application/json'+ header "Content-Type", "application/json"post path, params.to_jsonend- context 'when all embedded file link elements are valid' do- it_behaves_like 'API V3 collection response', 2, 2, 'FileLink' do+ context "when all embedded file link elements are valid" do+ it_behaves_like "API V3 collection response", 2, 2, "FileLink" dolet(:elements) { Storages::FileLink.order(id: :asc) }let(:expected_status_code) { 201 }endit(- 'creates corresponding FileLink records and ' \- 'provides a link to the collection of created file links',+ "creates corresponding FileLink records and " \+ "provides a link to the collection of created file links",:aggregate_failures) doexpect(Storages::FileLink.count).to eq 2@@ -329,11 +329,11 @@ RSpec.describe 'API v3 file links resource' doendend- expect(response.body).to be_json_eql(path.to_json).at_path('_links/self/href')+ expect(response.body).to be_json_eql(path.to_json).at_path("_links/self/href")endend- context 'when some embedded file link elements are NOT valid' do+ context "when some embedded file link elements are NOT valid" dolet(:embedded_elements) do[build(:file_link_element, :invalid, storage_url:),@@ -341,27 +341,27 @@ RSpec.describe 'API v3 file links resource' do]end- it_behaves_like 'constraint violation' do- let(:message) { 'Error attempting to create dependent object: File link ' }+ it_behaves_like "constraint violation" do+ let(:message) { "Error attempting to create dependent object: File link " }end- it 'does not create any FileLink records' do+ it "does not create any FileLink records" doexpect(Storages::FileLink.find_by(origin_name: "the valid one")).to be_nilexpect(Storages::FileLink.count).to eq 0endend- context 'when some file link elements with matching origin_id, container, and storage already exist in database' do+ context "when some file link elements with matching origin_id, container, and storage already exist in database" dolet(:existing_file_link) docreate(:file_link,- origin_name: 'original name',+ origin_name: "original name",creator: current_user,container: work_package,storage:)endlet(:already_existing_file_link_payload) dobuild(:file_link_element,- origin_name: 'new name',+ origin_name: "new name",origin_id: existing_file_link.origin_id,storage_url: existing_file_link.storage.host)end@@ -375,107 +375,107 @@ RSpec.describe 'API v3 file links resource' do]end- it_behaves_like 'API V3 collection response', 2, 2, 'FileLink' do+ it_behaves_like "API V3 collection response", 2, 2, "FileLink" dolet(:elements) { Storages::FileLink.order(id: :asc) }let(:expected_status_code) { 201 }endit(- 'does not create any new FileLink records for the already existing one and' \- 'does not update the existing FileLink metadata from the POSTed one'+ "does not create any new FileLink records for the already existing one and" \+ "does not update the existing FileLink metadata from the POSTed one") doexpect(Storages::FileLink.count).to eq 2- expect(existing_file_link.reload.origin_name).to eq 'original name'+ expect(existing_file_link.reload.origin_name).to eq "original name"endend- context 'when multiple file links elements are submitted with same origin_id, container, and storage' do+ context "when multiple file links elements are submitted with same origin_id, container, and storage" dolet(:some_file_link_payload) { build(:file_link_element, storage_url: storage.host) }let(:embedded_elements) do[- some_file_link_payload.deep_merge(originData: { name: 'first name' }),- some_file_link_payload.deep_merge(originData: { name: 'second name' }),- some_file_link_payload.deep_merge(originData: { name: 'third name' })+ some_file_link_payload.deep_merge(originData: { name: "first name" }),+ some_file_link_payload.deep_merge(originData: { name: "second name" }),+ some_file_link_payload.deep_merge(originData: { name: "third name" })]end- it_behaves_like 'API V3 collection response', 3, 3, 'FileLink' do+ it_behaves_like "API V3 collection response", 3, 3, "FileLink" dolet(:elements) { Storages::FileLink.order(id: :asc) }let(:expected_status_code) { 201 }endit(- 'creates only one FileLink for all duplicates and ' \- 'uses metadata from the first item and ' \- 'replies with as many embedded elements as in the request, all identical'+ "creates only one FileLink for all duplicates and " \+ "uses metadata from the first item and " \+ "replies with as many embedded elements as in the request, all identical") doexpect(Storages::FileLink.count).to eq 1- expect(Storages::FileLink.first.origin_name).to eq 'first name'+ expect(Storages::FileLink.first.origin_name).to eq "first name"- replied_elements = JSON.parse(last_response.body).dig('_embedded', 'elements')+ replied_elements = JSON.parse(last_response.body).dig("_embedded", "elements")expect(replied_elements.count).to eq(embedded_elements.count)expect(replied_elements[1..]).to all(eq(replied_elements.first))endend- context 'when storage host is invalid' do- context 'when unknown host' do- let(:storage_url) { 'https://invalid.host.org/' }+ context "when storage host is invalid" do+ context "when unknown host" do+ let(:storage_url) { "https://invalid.host.org/" }- it_behaves_like 'constraint violation' do- let(:message) { 'Storage does not exist' }+ it_behaves_like "constraint violation" do+ let(:message) { "Storage does not exist" }endend- context 'when nil' do+ context "when nil" dolet(:storage_url) { nil }- it_behaves_like 'constraint violation' do+ it_behaves_like "constraint violation" dolet(:message) { "Storage can't be blank." }endend- context 'when empty' do+ context "when empty" dolet(:storage_url) { "" }- it_behaves_like 'constraint violation' do+ it_behaves_like "constraint violation" dolet(:message) { "Storage can't be blank." }endend- context 'when not linked to the project of the work package' do+ context "when not linked to the project of the work package" dolet(:storage_url) { another_storage.host }- it_behaves_like 'constraint violation' do- let(:message) { 'Storage is not linked to project' }+ it_behaves_like "constraint violation" do+ let(:message) { "Storage is not linked to project" }endendend- context 'when no _embedded/elements in given json' do+ context "when no _embedded/elements in given json" dolet(:params) do{}end- it_behaves_like 'missing property', I18n.t('api_v3.errors.missing_property', property: '_embedded/elements')+ it_behaves_like "missing property", I18n.t("api_v3.errors.missing_property", property: "_embedded/elements")end- context 'when _embedded/elements is empty' do+ context "when _embedded/elements is empty" dolet(:embedded_elements) { [] }- it_behaves_like 'missing property', I18n.t('api_v3.errors.missing_property', property: '_embedded/elements')+ it_behaves_like "missing property", I18n.t("api_v3.errors.missing_property", property: "_embedded/elements")end- context 'when _embedded/elements is not an array' do+ context "when _embedded/elements is not an array" dolet(:embedded_elements) { 42 }- it_behaves_like 'format error',- I18n.t('api_v3.errors.invalid_format',- property: '_embedded/elements',- expected_format: 'Array',- actual: 'Integer')+ it_behaves_like "format error",+ I18n.t("api_v3.errors.invalid_format",+ property: "_embedded/elements",+ expected_format: "Array",+ actual: "Integer")endcontext "when more than #{Storages::Peripherals::ParseCreateParamsService::MAX_ELEMENTS} embedded elements" do@@ -483,135 +483,135 @@ RSpec.describe 'API v3 file links resource' dolet(:too_many) { max + 1 }let(:embedded_elements) { build_list(:file_link_element, too_many, storage_url:) }- it_behaves_like 'constraint violation' do+ it_behaves_like "constraint violation" dolet(:message) { "Too many elements created at once. Expected #{max} at most, got #{too_many}." }endendend- describe 'GET /api/v3/file_links/:file_link_id' do+ describe "GET /api/v3/file_links/:file_link_id" dolet(:path) { api_v3_paths.file_link(file_link.id) }before { get path }- it 'is successful' do+ it "is successful" doexpect(subject.status).to be 200end- context 'if user has not sufficient permissions' do+ context "if user has not sufficient permissions" dobefore(:all) { remove_permissions(current_user, :view_file_links) }after(:all) { add_permissions(current_user, :view_file_links) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if no file link with that id exists' do+ context "if no file link with that id exists" dolet(:path) { api_v3_paths.file_link(1337) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if file link is in a work package, while its project is not mapped to the file link\'s storage.' do+ context "if file link is in a work package, while its project is not mapped to the file link's storage." dolet(:path) { api_v3_paths.file_link(file_link_of_another_storage.id) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if file link is in a work package, while the storages module is deactivated in its project.' do- before(:all) { disable_module(project, 'storages') }- after(:all) { enable_module(project, 'storages') }+ context "if file link is in a work package, while the storages module is deactivated in its project." do+ before(:all) { disable_module(project, "storages") }+ after(:all) { enable_module(project, "storages") }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if file link does not have a container.' do+ context "if file link does not have a container." dolet(:file_link) { create(:file_link) }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- describe 'DELETE /api/v3/file_links/:file_link_id' do+ describe "DELETE /api/v3/file_links/:file_link_id" dolet(:path) { api_v3_paths.file_link(file_link.id) }before(:all) { add_permissions(current_user, :manage_file_links) }after(:all) { remove_permissions(current_user, :manage_file_links) }before do- header 'Content-Type', 'application/json'+ header "Content-Type", "application/json"delete pathend- it 'is successful' do+ it "is successful" doexpect(subject.status).to be 204expect(Storages::FileLink.exists?(id: file_link.id)).to be falseend- context 'if user has no view permissions' do+ context "if user has no view permissions" dobefore(:all) { remove_permissions(current_user, :view_file_links) }after(:all) { add_permissions(current_user, :view_file_links) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if user has no manage permissions' do+ context "if user has no manage permissions" dobefore(:all) { remove_permissions(current_user, :manage_file_links) }after(:all) { add_permissions(current_user, :manage_file_links) }- it_behaves_like 'unauthorized access'+ it_behaves_like "unauthorized access"end- context 'if no file link with that id exists' do+ context "if no file link with that id exists" dolet(:path) { api_v3_paths.file_link(1337) }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- describe 'GET /api/v3/file_links/:file_link_id/open' do+ describe "GET /api/v3/file_links/:file_link_id/open" dolet(:path) { api_v3_paths.file_link_open(file_link.id) }before { get path }- it 'is successful' do+ it "is successful" doexpect(subject.status).to be 303end- context 'with location flag' do+ context "with location flag" dolet(:path) { api_v3_paths.file_link_open(file_link.id, true) }- it 'is successful' do+ it "is successful" doexpect(subject.status).to be 303endend- context 'if user has no view permissions' do+ context "if user has no view permissions" dobefore(:all) { remove_permissions(current_user, :view_file_links) }after(:all) { add_permissions(current_user, :view_file_links) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if no storage with that id exists' do+ context "if no storage with that id exists" dolet(:path) { api_v3_paths.file_link(1337) }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- describe 'GET /api/v3/file_links/:file_link_id/download' do+ describe "GET /api/v3/file_links/:file_link_id/download" dolet(:path) { api_v3_paths.file_link_download(file_link.id) }- let(:url) { 'https://starkiller.nextcloud.com/direct/xyz' }+ let(:url) { "https://starkiller.nextcloud.com/direct/xyz" }- describe 'with successful response' do+ describe "with successful response" dobefore doStorages::Peripherals::Registry.stub(- 'nextcloud.queries.download_link',+ "nextcloud.queries.download_link",->(_) { ServiceResult.success(result: url) })end- it 'responds successfully' do+ it "responds successfully" doget pathexpect(subject.status).to be(303)@@ -619,37 +619,37 @@ RSpec.describe 'API v3 file links resource' doendend- describe 'with query failed' do+ describe "with query failed" dobefore doStorages::Peripherals::Registry.stub(- 'nextcloud.queries.download_link',+ "nextcloud.queries.download_link",->(_) { ServiceResult.failure(result: error, errors: Storages::StorageError.new(code: error)) })get pathend- describe 'due to authorization failure' do+ describe "due to authorization failure" dolet(:error) { :unauthorized }it { expect(subject.status).to be(500) }end- describe 'due to internal error' do+ describe "due to internal error" dolet(:error) { :error }it { expect(subject.status).to be(500) }end- describe 'due to not found' do+ describe "due to not found" dolet(:error) { :not_found }- it 'fails with outbound request failure' do+ it "fails with outbound request failure" doexpect(last_response.status).to be(500)body = JSON.parse(last_response.body)- expect(body['message']).to eq(I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 404))- expect(body['errorIdentifier']).to eq('urn:openproject-org:api:v3:errors:OutboundRequest:NotFound')+ expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 404))+ expect(body["errorIdentifier"]).to eq("urn:openproject-org:api:v3:errors:OutboundRequest:NotFound")endendenddiff --git a/spec/factories/custom_field_section.rb b/spec/factories/custom_field_section.rbindex 861b2f049d1..e5a622739a3 100644--- a/spec/factories/custom_field_section.rb+++ b/spec/factories/custom_field_section.rb@@ -32,6 +32,6 @@ FactoryBot.define docreated_at { Time.zone.now }updated_at { Time.zone.now }- factory :project_custom_field_section, class: 'ProjectCustomFieldSection'+ factory :project_custom_field_section, class: "ProjectCustomFieldSection"endenddiff --git a/spec/features/admin/project_custom_fields/shared_context.rb b/spec/features/admin/project_custom_fields/shared_context.rbindex ee6b3faf084..a8e407c53e1 100644--- a/spec/features/admin/project_custom_fields/shared_context.rb+++ b/spec/features/admin/project_custom_fields/shared_context.rb@@ -26,75 +26,75 @@# See COPYRIGHT and LICENSE files for more details.#++-RSpec.shared_context 'with seeded project custom fields' do+RSpec.shared_context "with seeded project custom fields" doshared_let(:admin) { create(:admin) }shared_let(:non_admin) { create(:user) }- shared_let(:section_for_input_fields) { create(:project_custom_field_section, name: 'Input fields') }- shared_let(:section_for_select_fields) { create(:project_custom_field_section, name: 'Select fields') }- shared_let(:section_for_multi_select_fields) { create(:project_custom_field_section, name: 'Multi select fields') }+ shared_let(:section_for_input_fields) { create(:project_custom_field_section, name: "Input fields") }+ shared_let(:section_for_select_fields) { create(:project_custom_field_section, name: "Select fields") }+ shared_let(:section_for_multi_select_fields) { create(:project_custom_field_section, name: "Multi select fields") }let!(:boolean_project_custom_field) do- create(:boolean_project_custom_field, name: 'Boolean field',+ create(:boolean_project_custom_field, name: "Boolean field",project_custom_field_section: section_for_input_fields)endlet!(:string_project_custom_field) do- create(:string_project_custom_field, name: 'String field',+ create(:string_project_custom_field, name: "String field",project_custom_field_section: section_for_input_fields)endlet!(:integer_project_custom_field) do- create(:integer_project_custom_field, name: 'Integer field',+ create(:integer_project_custom_field, name: "Integer field",project_custom_field_section: section_for_input_fields)endlet!(:float_project_custom_field) do- create(:float_project_custom_field, name: 'Float field',+ create(:float_project_custom_field, name: "Float field",project_custom_field_section: section_for_input_fields)endlet!(:date_project_custom_field) do- create(:date_project_custom_field, name: 'Date field',+ create(:date_project_custom_field, name: "Date field",project_custom_field_section: section_for_input_fields)endlet!(:text_project_custom_field) do- create(:text_project_custom_field, name: 'Text field',+ create(:text_project_custom_field, name: "Text field",project_custom_field_section: section_for_input_fields)endlet!(:list_project_custom_field) do- create(:list_project_custom_field, name: 'List field',+ create(:list_project_custom_field, name: "List field",project_custom_field_section: section_for_select_fields,- possible_values: ['Option 1', 'Option 2', 'Option 3'])+ possible_values: ["Option 1", "Option 2", "Option 3"])endlet!(:version_project_custom_field) do- create(:version_project_custom_field, name: 'Version field',+ create(:version_project_custom_field, name: "Version field",project_custom_field_section: section_for_select_fields)endlet!(:user_project_custom_field) do- create(:user_project_custom_field, name: 'User field',+ create(:user_project_custom_field, name: "User field",project_custom_field_section: section_for_select_fields)endlet!(:multi_list_project_custom_field) do- create(:list_project_custom_field, name: 'Multi list field',+ create(:list_project_custom_field, name: "Multi list field",project_custom_field_section: section_for_multi_select_fields,- possible_values: ['Option 1', 'Option 2', 'Option 3'],+ possible_values: ["Option 1", "Option 2", "Option 3"],multi_value: true)endlet!(:multi_version_project_custom_field) do- create(:version_project_custom_field, name: 'Multi version field',+ create(:version_project_custom_field, name: "Multi version field",project_custom_field_section: section_for_multi_select_fields,multi_value: true)endlet!(:multi_user_project_custom_field) do- create(:user_project_custom_field, name: 'Multi user field',+ create(:user_project_custom_field, name: "Multi user field",project_custom_field_section: section_for_multi_select_fields,multi_value: true)enddiff --git a/spec/features/custom_fields/custom_fields_spec.rb b/spec/features/custom_fields/custom_fields_spec.rbindex ee07c28bde2..d661cbce936 100644--- a/spec/features/custom_fields/custom_fields_spec.rb+++ b/spec/features/custom_fields/custom_fields_spec.rb@@ -1,7 +1,7 @@-require 'spec_helper'-require 'support/pages/custom_fields'+require "spec_helper"+require "support/pages/custom_fields"-RSpec.describe 'custom fields', :js, :with_cuprite do+RSpec.describe "custom fields", :js, :with_cuprite dolet(:user) { create(:admin) }let(:cf_page) { Pages::CustomFields.new }@@ -21,22 +21,22 @@ RSpec.describe 'custom fields', :js, :with_cuprite doexpect(page).to have_text("Allow multi-select")check("custom_field_multi_value")- expect(page).to have_css('.custom-option-row', count: 1)+ expect(page).to have_css(".custom-option-row", count: 1)within all(".custom-option-row").last dofind(".custom-option-value input").set "Windows"find(".custom-option-default-value input").set trueend- page.find_test_selector('add-custom-option').click+ page.find_test_selector("add-custom-option").click- expect(page).to have_css('.custom-option-row', count: 2)+ expect(page).to have_css(".custom-option-row", count: 2)within all(".custom-option-row").last dofind(".custom-option-value input").set "Linux"end- page.find_test_selector('add-custom-option').click+ page.find_test_selector("add-custom-option").click- expect(page).to have_css('.custom-option-row', count: 3)+ expect(page).to have_css(".custom-option-row", count: 3)within all(".custom-option-row").last dofind(".custom-option-value input").set "Solaris"@@ -52,7 +52,7 @@ RSpec.describe 'custom fields', :js, :with_cuprite doexpect(page).to have_field("custom_field_multi_value", checked: true)- expect(page).to have_css('.custom-option-row', count: 3)+ expect(page).to have_css(".custom-option-row", count: 3)expect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "Solaris")expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "Windows")expect(page).to have_field("custom_field_custom_options_attributes_2_value", with: "Linux")@@ -70,14 +70,14 @@ RSpec.describe 'custom fields', :js, :with_cuprite docf_page.set_name "Ignored"# Form element labels, default English translation in the trailing comment:- label_min_length = I18n.t('activerecord.attributes.custom_field.min_length') # Minimum length- label_max_length = I18n.t('activerecord.attributes.custom_field.max_length') # Maximum length- label_regexp = I18n.t('activerecord.attributes.custom_field.regexp') # Regular expression- label_multi_value = I18n.t('activerecord.attributes.custom_field.multi_value') # Allow multi-select- label_allow_non_open_versions = I18n.t('activerecord.attributes.custom_field.allow_non_open_versions') # Allow non-open versions- label_possible_values = I18n.t('activerecord.attributes.custom_field.possible_values').upcase # Possible values, capitalized on UI- label_default_value = I18n.t('activerecord.attributes.custom_field.default_value') # Default value- label_is_required = I18n.t('activerecord.attributes.custom_field.is_required') # Required+ label_min_length = I18n.t("activerecord.attributes.custom_field.min_length") # Minimum length+ label_max_length = I18n.t("activerecord.attributes.custom_field.max_length") # Maximum length+ label_regexp = I18n.t("activerecord.attributes.custom_field.regexp") # Regular expression+ label_multi_value = I18n.t("activerecord.attributes.custom_field.multi_value") # Allow multi-select+ label_allow_non_open_versions = I18n.t("activerecord.attributes.custom_field.allow_non_open_versions") # Allow non-open versions+ label_possible_values = I18n.t("activerecord.attributes.custom_field.possible_values").upcase # Possible values, capitalized on UI+ label_default_value = I18n.t("activerecord.attributes.custom_field.default_value") # Default value+ label_is_required = I18n.t("activerecord.attributes.custom_field.is_required") # Required# Spent time SFs don't show "Searchable". Not tested here.# Project CFs don't show "For all projects" and "Used as a filter". Not tested here.# Content right to left is not shown for Project CFs Long text. Strange. Not tested.@@ -176,23 +176,23 @@ RSpec.describe 'custom fields', :js, :with_cuprite doclick_on "Create a new custom field"wait_for_reload- page.within_test_selector('op-breadcrumb') do- expect(page).to have_css('.breadcrumb-item', text: type)- expect(page).to have_css('.breadcrumb-item.breadcrumb-item-selected', text: "New custom field")+ page.within_test_selector("op-breadcrumb") do+ expect(page).to have_css(".breadcrumb-item", text: type)+ expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "New custom field")endendend- describe 'work packages' do- it_behaves_like "creating a new custom field", 'Work packages'+ describe "work packages" do+ it_behaves_like "creating a new custom field", "Work packages"end- describe 'time entries' do- it_behaves_like "creating a new custom field", 'Spent time'+ describe "time entries" do+ it_behaves_like "creating a new custom field", "Spent time"end- describe 'versions' do- it_behaves_like "creating a new custom field", 'Versions'+ describe "versions" do+ it_behaves_like "creating a new custom field", "Versions"endcontext "with an existing list custom field" do@@ -213,18 +213,18 @@ RSpec.describe 'custom fields', :js, :with_cuprite doendit "adds new options" do- page.find_test_selector('add-custom-option').click+ page.find_test_selector("add-custom-option").clickwait_for_reload- expect(page).to have_css('.custom-option-row', count: 5)+ expect(page).to have_css(".custom-option-row", count: 5)within all(".custom-option-row").last dofind(".custom-option-value input").set "Sega"end- page.find_test_selector('add-custom-option').click+ page.find_test_selector("add-custom-option").clickwait_for_reload- expect(page).to have_css('.custom-option-row', count: 6)+ expect(page).to have_css(".custom-option-row", count: 6)within all(".custom-option-row").last dofind(".custom-option-value input").set "Atari"end@@ -233,7 +233,7 @@ RSpec.describe 'custom fields', :js, :with_cuprite doexpect(page).to have_text("Successful update")expect(page).to have_text("Platform")- expect(page).to have_css('.custom-option-row', count: 6)+ expect(page).to have_css(".custom-option-row", count: 6)%w[Playstation Xbox Nintendo PC Sega Atari].each_with_index do |value, i|expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)@@ -243,7 +243,7 @@ RSpec.describe 'custom fields', :js, :with_cuprite doit "updates the values and orders of the custom options" doexpect(page).to have_text("Platform")- expect(page).to have_css('.custom-option-row', count: 4)+ expect(page).to have_css(".custom-option-row", count: 4)%w[Playstation Xbox Nintendo PC].each_with_index do |value, i|expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)end@@ -273,9 +273,9 @@ RSpec.describe 'custom fields', :js, :with_cuprite doendit "shows the correct breadcrumbs" do- page.within_test_selector('op-breadcrumb') do- expect(page).to have_css('.breadcrumb-item', text: "Work packages")- expect(page).to have_css('.breadcrumb-item.breadcrumb-item-selected', text: "Platform")+ page.within_test_selector("op-breadcrumb") do+ expect(page).to have_css(".breadcrumb-item", text: "Work packages")+ expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "Platform")endend@@ -292,7 +292,7 @@ RSpec.describe 'custom fields', :js, :with_cuprite doit "deletes a custom option and all values using it" dowithin all(".custom-option-row")[1] doaccept_alert do- find('.icon-delete').click+ find(".icon-delete").clickendenddiff --git a/spec/features/menu_items/admin_menu_item_spec.rb b/spec/features/menu_items/admin_menu_item_spec.rbindex d3e62459356..df949576328 100644--- a/spec/features/menu_items/admin_menu_item_spec.rb+++ b/spec/features/menu_items/admin_menu_item_spec.rb@@ -26,9 +26,9 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe 'Admin menu items',+RSpec.describe "Admin menu items",:js,:with_cuprite doshared_let(:user) { create(:admin) }@@ -39,39 +39,39 @@ RSpec.describe 'Admin menu items',endafter do- OpenProject::Configuration['hidden_menu_items'] = []+ OpenProject::Configuration["hidden_menu_items"] = []end- context 'without having any menu items hidden in configuration' do- it 'must display all menu items' do- expect(page).to have_test_selector('menu-blocks--container')- expect(page).to have_test_selector('menu-block', count: 22)- expect(page).to have_test_selector('op-menu--item-action', count: 23) # All plus 'overview'+ context "without having any menu items hidden in configuration" do+ it "must display all menu items" do+ expect(page).to have_test_selector("menu-blocks--container")+ expect(page).to have_test_selector("menu-block", count: 22)+ expect(page).to have_test_selector("op-menu--item-action", count: 23) # All plus 'overview'endend- context 'having custom hidden menu items',+ context "having custom hidden menu items",with_config: {- 'hidden_menu_items' => { 'admin_menu' => ['colors'] }+ "hidden_menu_items" => { "admin_menu" => ["colors"] }} do- it 'must not display the hidden menu items and blocks' do- expect(page).to have_test_selector('menu-blocks--container')- expect(page).to have_test_selector('menu-block', count: 21)- expect(page).not_to have_test_selector('menu-block', text: I18n.t(:label_color_plural))+ it "must not display the hidden menu items and blocks" do+ expect(page).to have_test_selector("menu-blocks--container")+ expect(page).to have_test_selector("menu-block", count: 21)+ expect(page).not_to have_test_selector("menu-block", text: I18n.t(:label_color_plural))- expect(page).to have_test_selector('op-menu--item-action', count: 22) # All plus 'overview'- expect(page).not_to have_test_selector('op-menu--item-action', text: I18n.t(:label_color_plural))+ expect(page).to have_test_selector("op-menu--item-action", count: 22) # All plus 'overview'+ expect(page).not_to have_test_selector("op-menu--item-action", text: I18n.t(:label_color_plural))endend- context 'when logged in with a non-admin user with specific admin permissions' do+ context "when logged in with a non-admin user with specific admin permissions" doshared_let(:user) { create(:user, global_permissions: %i[manage_user create_backup]) }- it 'must display only the actions allowed by global permissions' do- expect(page).to have_test_selector('menu-block', text: I18n.t('label_user_plural'))- expect(page).to have_test_selector('menu-block', text: I18n.t('label_backup'))- expect(page).to have_test_selector('op-menu--item-action', text: I18n.t('label_user_plural'))- expect(page).to have_test_selector('op-menu--item-action', text: I18n.t('label_backup'))+ it "must display only the actions allowed by global permissions" do+ expect(page).to have_test_selector("menu-block", text: I18n.t("label_user_plural"))+ expect(page).to have_test_selector("menu-block", text: I18n.t("label_backup"))+ expect(page).to have_test_selector("op-menu--item-action", text: I18n.t("label_user_plural"))+ expect(page).to have_test_selector("op-menu--item-action", text: I18n.t("label_backup"))endendenddiff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rbindex 286077a6c56..df43430e245 100644--- a/spec/features/projects/create_spec.rb+++ b/spec/features/projects/create_spec.rb@@ -26,17 +26,17 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe 'Projects', 'creation',+RSpec.describe "Projects", "creation",:js,:with_cuprite doshared_let(:name_field) { FormFields::InputFormField.new :name }- shared_let(:project_custom_field_section) { create(:project_custom_field_section, name: 'Section A') }+ shared_let(:project_custom_field_section) { create(:project_custom_field_section, name: "Section A") }current_user { create(:admin) }- shared_let(:project) { create(:project, name: 'Foo project', identifier: 'foo-project') }+ shared_let(:project) { create(:project, name: "Foo project", identifier: "foo-project") }let(:projects_page) { Pages::Projects::Index.new }@@ -44,134 +44,134 @@ RSpec.describe 'Projects', 'creation',projects_page.visit!end- context 'with the button on the toolbar items' do- it 'can navigate to the create project page' do+ context "with the button on the toolbar items" do+ it "can navigate to the create project page" doprojects_page.navigate_to_new_project_page_from_toolbar_itemsexpect(page).to have_current_path(new_project_path)endend- it 'can create a project' do+ it "can create a project" doprojects_page.navigate_to_new_project_page_from_toolbar_items- name_field.set_value 'Foo bar'- click_button 'Save'+ name_field.set_value "Foo bar"+ click_button "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/- expect(page).to have_content 'Foo bar'+ expect(page).to have_content "Foo bar"end- it 'does not create a project with an already existing identifier' do+ it "does not create a project with an already existing identifier" doprojects_page.navigate_to_new_project_page_from_toolbar_items- name_field.set_value 'Foo project'- click_on 'Save'+ name_field.set_value "Foo project"+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-project-1\/?/project = Project.last- expect(project.identifier).to eq 'foo-project-1'+ expect(project.identifier).to eq "foo-project-1"end- context 'with a multi-select custom field' do+ context "with a multi-select custom field" dolet!(:list_custom_field) do- create(:list_project_custom_field, name: 'List CF', multi_value: true, project_custom_field_section:)+ create(:list_project_custom_field, name: "List CF", multi_value: true, project_custom_field_section:)endlet(:list_field) { FormFields::SelectFormField.new list_custom_field }- it 'can create a project' do+ it "can create a project" doprojects_page.navigate_to_new_project_page_from_toolbar_items- name_field.set_value 'Foo bar'+ name_field.set_value "Foo bar"- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").click- list_field.select_option 'A', 'B'+ list_field.select_option "A", "B"- click_button 'Save'+ click_button "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/- expect(page).to have_content 'Foo bar'+ expect(page).to have_content "Foo bar"project = Project.last- expect(project.name).to eq 'Foo bar'+ expect(project.name).to eq "Foo bar"cvs = project.custom_value_for(list_custom_field)expect(cvs.count).to eq 2- expect(cvs.map(&:typed_value)).to contain_exactly 'A', 'B'+ expect(cvs.map(&:typed_value)).to contain_exactly "A", "B"endend- it 'hides the active field and the identifier' do+ it "hides the active field and the identifier" dovisit new_project_path- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").click- expect(page).to have_no_content 'Active'- expect(page).to have_no_content 'Identifier'+ expect(page).to have_no_content "Active"+ expect(page).to have_no_content "Identifier"end- context 'with optional and required custom fields' do+ context "with optional and required custom fields" dolet!(:optional_custom_field) do- create(:project_custom_field, name: 'Optional Foo',- field_format: 'string',+ create(:project_custom_field, name: "Optional Foo",+ field_format: "string",is_for_all: true,project_custom_field_section:)endlet!(:required_custom_field) do- create(:project_custom_field, name: 'Required Foo',- field_format: 'string',+ create(:project_custom_field, name: "Required Foo",+ field_format: "string",is_for_all: true,is_required: true,project_custom_field_section:)end- it 'separates optional and required custom fields for new' do+ it "separates optional and required custom fields for new" dovisit new_project_path- expect(page).to have_content 'Required Foo'+ expect(page).to have_content "Required Foo"- click_on 'Advanced settings'+ click_on "Advanced settings"- within('.op-fieldset') do- expect(page).to have_text 'Optional Foo'- expect(page).to have_no_text 'Required Foo'+ within(".op-fieldset") do+ expect(page).to have_text "Optional Foo"+ expect(page).to have_no_text "Required Foo"endend- context 'with correct validations' do+ context "with correct validations" dobefore dovisit new_project_pathend- it 'requires the required custom field' do- click_on 'Save'+ it "requires the required custom field" do+ click_on "Save"expect(page).to have_content "Required Foo can't be blank"expect(page).to have_no_content "Optional Foo can't be blank"endend- context 'with correct custom field activation' do+ context "with correct custom field activation" dolet!(:unused_custom_field) do- create(:project_custom_field, name: 'Unused Foo',- field_format: 'string',+ create(:project_custom_field, name: "Unused Foo",+ field_format: "string",project_custom_field_section:)endbefore dovisit new_project_path- fill_in 'Name', with: 'Foo bar'- fill_in 'Required Foo', with: 'Required value'+ fill_in "Name", with: "Foo bar"+ fill_in "Required Foo", with: "Required value"- click_on 'Advanced settings'+ click_on "Advanced settings"end- it 'enables custom fields with provided values for this project' do- fill_in 'Optional Foo', with: 'Optional value'- fill_in 'Unused Foo', with: ''+ it "enables custom fields with provided values for this project" do+ fill_in "Optional Foo", with: "Optional value"+ fill_in "Unused Foo", with: ""- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -183,25 +183,25 @@ RSpec.describe 'Projects', 'creation',)end- context 'with correct handling of default values' do+ context "with correct handling of default values" dolet!(:custom_field_with_default_value) do- create(:project_custom_field, name: 'Foo with default value',- field_format: 'string',- default_value: 'Default value',+ create(:project_custom_field, name: "Foo with default value",+ field_format: "string",+ default_value: "Default value",project_custom_field_section:)endbefore dovisit new_project_path- fill_in 'Name', with: 'Foo bar'- fill_in 'Required Foo', with: 'Required value'+ fill_in "Name", with: "Foo bar"+ fill_in "Required Foo", with: "Required value"- click_on 'Advanced settings'+ click_on "Advanced settings"end- it 'enables custom fields with default values if not set to blank explicitly' do+ it "enables custom fields with default values if not set to blank explicitly" do# don't touch the default value- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -212,15 +212,15 @@ RSpec.describe 'Projects', 'creation',custom_field_with_default_value.id, required_custom_field.id)- expect(project.custom_value_for(custom_field_with_default_value).value).to eq('Default value')+ expect(project.custom_value_for(custom_field_with_default_value).value).to eq("Default value")end- it 'does not enable custom fields with default values if set to blank explicitly' do+ it "does not enable custom fields with default values if set to blank explicitly" do# native blank input does not work with this input, using support class herefield = FormFields::InputFormField.new(custom_field_with_default_value)field.set_value("")- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -232,10 +232,10 @@ RSpec.describe 'Projects', 'creation',)end- it 'does enable custom fields with default values if overwritten with a new value' do- fill_in 'Foo with default value', with: 'foo'+ it "does enable custom fields with default values if overwritten with a new value" do+ fill_in "Foo with default value", with: "foo"- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -246,42 +246,42 @@ RSpec.describe 'Projects', 'creation',custom_field_with_default_value.id, required_custom_field.id)- expect(project.custom_value_for(custom_field_with_default_value).value).to eq('foo')+ expect(project.custom_value_for(custom_field_with_default_value).value).to eq("foo")endend- context 'with correct handling of optional boolean values' do+ context "with correct handling of optional boolean values" dolet!(:custom_boolean_field_default_true) do- create(:project_custom_field, name: 'Boolean with default true',- field_format: 'bool',+ create(:project_custom_field, name: "Boolean with default true",+ field_format: "bool",default_value: true,project_custom_field_section:)endlet!(:custom_boolean_field_default_false) do- create(:project_custom_field, name: 'Boolean with default false',- field_format: 'bool',+ create(:project_custom_field, name: "Boolean with default false",+ field_format: "bool",default_value: false,project_custom_field_section:)endlet!(:custom_boolean_field_with_no_default) do- create(:project_custom_field, name: 'Boolean with no default',- field_format: 'bool',+ create(:project_custom_field, name: "Boolean with no default",+ field_format: "bool",project_custom_field_section:)endbefore dovisit new_project_path- fill_in 'Name', with: 'Foo bar'- fill_in 'Required Foo', with: 'Required value'+ fill_in "Name", with: "Foo bar"+ fill_in "Required Foo", with: "Required value"- click_on 'Advanced settings'+ click_on "Advanced settings"end- it 'only enables boolean custom fields with default values if untouched' do+ it "only enables boolean custom fields with default values if untouched" do# do not touch any of the boolean fields- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -297,10 +297,10 @@ RSpec.describe 'Projects', 'creation',expect(project.custom_value_for(custom_boolean_field_default_false).typed_value).to be_falsyend- it 'enables boolean custom fields without default values if set to true explicitly' do- check 'Boolean with no default'+ it "enables boolean custom fields without default values if set to true explicitly" do+ check "Boolean with no default"- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -316,10 +316,10 @@ RSpec.describe 'Projects', 'creation',expect(project.custom_value_for(custom_boolean_field_with_no_default).typed_value).to be_truthyend- it 'enables boolean custom fields with default values if set to false explicitly' do- uncheck 'Boolean with default true'+ it "enables boolean custom fields with default values if set to false explicitly" do+ uncheck "Boolean with default true"- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -336,28 +336,28 @@ RSpec.describe 'Projects', 'creation',endend- context 'with correct handling of invisible values' do+ context "with correct handling of invisible values" dolet!(:invisible_field) do- create(:string_project_custom_field, name: 'Text for Admins only',+ create(:string_project_custom_field, name: "Text for Admins only",visible: false,project_custom_field_section:)endbefore dovisit new_project_path- fill_in 'Name', with: 'Foo bar'- fill_in 'Required Foo', with: 'Required value'+ fill_in "Name", with: "Foo bar"+ fill_in "Required Foo", with: "Required value"- click_on 'Advanced settings'+ click_on "Advanced settings"end- context 'with an admin user' do- it 'shows invisible fields in the form and allows their activation' do- expect(page).to have_content 'Text for Admins only'+ context "with an admin user" do+ it "shows invisible fields in the form and allows their activation" do+ expect(page).to have_content "Text for Admins only"- fill_in 'Text for Admins only', with: 'foo'+ fill_in "Text for Admins only", with: "foo"- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/@@ -367,17 +367,17 @@ RSpec.describe 'Projects', 'creation',required_custom_field.id, invisible_field.id)- expect(project.custom_value_for(invisible_field).typed_value).to eq('foo')+ expect(project.custom_value_for(invisible_field).typed_value).to eq("foo")endend- context 'with a non-admin user' do+ context "with a non-admin user" docurrent_user { create(:user, global_permissions: %i[add_project]) }- it 'does not show invisible fields in the form and thus not activates the invisible field' do- expect(page).to have_no_content 'Text for Admins only'+ it "does not show invisible fields in the form and thus not activates the invisible field" do+ expect(page).to have_no_content "Text for Admins only"- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/foo-bar\/?/diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rbindex 8bf00e23429..80523365044 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require_relative '../shared_context'+require "spec_helper"+require_relative "../shared_context"-RSpec.describe 'Edit project custom fields on project overview page', :js do- include_context 'with seeded projects, members and project custom fields'+RSpec.describe "Edit project custom fields on project overview page", :js do+ include_context "with seeded projects, members and project custom fields"let(:overview_page) { Pages::Projects::Show.new(project) }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_input_fields) }@@ -40,13 +40,13 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dooverview_page.visit_pageend- it 'opens a dialog showing inputs for project custom fields of a specific section' do+ it "opens a dialog showing inputs for project custom fields of a specific section" dooverview_page.open_edit_dialog_for_section(section_for_input_fields)dialog.expect_openend- it 'renders the dialog body asynchronically' do+ it "renders the dialog body asynchronically" doexpect(page).to have_no_css(dialog.async_content_container_css_selector, visible: :all)overview_page.open_edit_dialog_for_section(section_for_input_fields)@@ -54,7 +54,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doexpect(page).to have_css(dialog.async_content_container_css_selector, visible: :visible)end- it 'can be closed via close icon or cancel button' do+ it "can be closed via close icon or cancel button" dooverview_page.open_edit_dialog_for_section(section_for_input_fields)dialog.close_via_icon@@ -68,7 +68,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.expect_closedend- it 'shows only the project custom fields of the specific section within the dialog' do+ it "shows only the project custom fields of the specific section within the dialog" dooverview_page.open_edit_dialog_for_section(section_for_input_fields)dialog.within_async_content(close_after_yield: true) do@@ -110,18 +110,18 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows the inputs in the correct order defined by the position of project custom field in a section' do+ it "shows the inputs in the correct order defined by the position of project custom field in a section" dooverview_page.open_edit_dialog_for_section(section_for_input_fields)dialog.within_async_content(close_after_yield: true) docontainers = dialog.input_containers- expect(containers[0].text).to include('Boolean field')- expect(containers[1].text).to include('String field')- expect(containers[2].text).to include('Integer field')- expect(containers[3].text).to include('Float field')- expect(containers[4].text).to include('Date field')- expect(containers[5].text).to include('Text field')+ expect(containers[0].text).to include("Boolean field")+ expect(containers[1].text).to include("String field")+ expect(containers[2].text).to include("Integer field")+ expect(containers[3].text).to include("Float field")+ expect(containers[4].text).to include("Date field")+ expect(containers[5].text).to include("Text field")endboolean_project_custom_field.move_to_bottom@@ -131,21 +131,21 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.within_async_content(close_after_yield: true) docontainers = dialog.input_containers- expect(containers[0].text).to include('String field')- expect(containers[1].text).to include('Integer field')- expect(containers[2].text).to include('Float field')- expect(containers[3].text).to include('Date field')- expect(containers[4].text).to include('Text field')- expect(containers[5].text).to include('Boolean field')+ expect(containers[0].text).to include("String field")+ expect(containers[1].text).to include("Integer field")+ expect(containers[2].text).to include("Float field")+ expect(containers[3].text).to include("Date field")+ expect(containers[4].text).to include("Text field")+ expect(containers[5].text).to include("Boolean field")endend- context 'with visibility of project custom fields' do- let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: 'Section with invisible fields') }+ context "with visibility of project custom fields" do+ let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: "Section with invisible fields") }let!(:visible_project_custom_field) docreate(:project_custom_field,- name: 'Normal field',+ name: "Normal field",visible: true,projects: [project],project_custom_field_section: section_with_invisible_fields)@@ -153,7 +153,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet!(:invisible_project_custom_field) docreate(:project_custom_field,- name: 'Admin only field',+ name: "Admin only field",visible: false,projects: [project],project_custom_field_section: section_with_invisible_fields)@@ -161,34 +161,34 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section_with_invisible_fields) }- context 'with admin permissions' do+ context "with admin permissions" dobefore dologin_as adminoverview_page.visit_pageend- it 'shows all project custom fields' do+ it "shows all project custom fields" dooverview_page.open_edit_dialog_for_section(section_with_invisible_fields)dialog.within_async_content(close_after_yield: true) do- expect(page).to have_content('Normal field')- expect(page).to have_content('Admin only field')+ expect(page).to have_content("Normal field")+ expect(page).to have_content("Admin only field")endendend- context 'with non-admin permissions' do+ context "with non-admin permissions" dobefore dologin_as member_with_project_edit_permissionsoverview_page.visit_pageend- it 'shows only visible project custom fields' do+ it "shows only visible project custom fields" dooverview_page.open_edit_dialog_for_section(section_with_invisible_fields)dialog.within_async_content(close_after_yield: true) do- expect(page).to have_content('Normal field')- expect(page).to have_no_content('Admin only field')+ expect(page).to have_content("Normal field")+ expect(page).to have_no_content("Admin only field")endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/shared_context.rb b/spec/features/projects/project_custom_fields/overview_page/shared_context.rbindex 5cfb258b243..8379cab6607 100644--- a/spec/features/projects/project_custom_fields/overview_page/shared_context.rb+++ b/spec/features/projects/project_custom_fields/overview_page/shared_context.rb@@ -26,13 +26,13 @@# See COPYRIGHT and LICENSE files for more details.#++-RSpec.shared_context 'with seeded projects, members and project custom fields' do- let(:project) { create(:project, name: 'Foo project', identifier: 'foo-project') }- let(:other_project) { create(:project, name: 'Bar project', identifier: 'bar-project') }+RSpec.shared_context "with seeded projects, members and project custom fields" do+ let(:project) { create(:project, name: "Foo project", identifier: "foo-project") }+ let(:other_project) { create(:project, name: "Bar project", identifier: "bar-project") }- let!(:first_version) { create(:version, name: 'Version 1', project:) }- let!(:second_version) { create(:version, name: 'Version 2', project:) }- let!(:third_version) { create(:version, name: 'Version 3', project:) }+ let!(:first_version) { create(:version, name: "Version 1", project:) }+ let!(:second_version) { create(:version, name: "Version 2", project:) }+ let!(:third_version) { create(:version, name: "Version 3", project:) }shared_let(:reader_role) docreate(:project_role, permissions: %i[view_work_packages])@@ -48,29 +48,29 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dlet!(:member_in_project) docreate(:user,- firstname: 'Member 1',- lastname: 'In Project',+ firstname: "Member 1",+ lastname: "In Project",member_with_roles: { project => reader_role })endlet!(:another_member_in_project) docreate(:user,- firstname: 'Member 2',- lastname: 'In Project',+ firstname: "Member 2",+ lastname: "In Project",member_with_roles: { project => reader_role })endlet!(:one_more_member_in_project) docreate(:user,- firstname: 'Member 3',- lastname: 'In Project',+ firstname: "Member 3",+ lastname: "In Project",member_with_roles: { project => reader_role })endlet!(:member_with_project_edit_permissions) docreate(:user,- firstname: 'Member',- lastname: 'With Project Edit Permissions',+ firstname: "Member",+ lastname: "With Project Edit Permissions",member_with_roles: { project => edit_role })end@@ -78,12 +78,12 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dmember_in_projectend- let!(:section_for_input_fields) { create(:project_custom_field_section, name: 'Input fields') }- let!(:section_for_select_fields) { create(:project_custom_field_section, name: 'Select fields') }- let!(:section_for_multi_select_fields) { create(:project_custom_field_section, name: 'Multi select fields') }+ let!(:section_for_input_fields) { create(:project_custom_field_section, name: "Input fields") }+ let!(:section_for_select_fields) { create(:project_custom_field_section, name: "Select fields") }+ let!(:section_for_multi_select_fields) { create(:project_custom_field_section, name: "Multi select fields") }let!(:boolean_project_custom_field) do- field = create(:boolean_project_custom_field, projects: [project], name: 'Boolean field',+ field = create(:boolean_project_custom_field, projects: [project], name: "Boolean field",project_custom_field_section: section_for_input_fields)create(:custom_value, customized: project, custom_field: field, value: true)@@ -92,16 +92,16 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:string_project_custom_field) do- field = create(:string_project_custom_field, projects: [project], name: 'String field',+ field = create(:string_project_custom_field, projects: [project], name: "String field",project_custom_field_section: section_for_input_fields)- create(:custom_value, customized: project, custom_field: field, value: 'Foo')+ create(:custom_value, customized: project, custom_field: field, value: "Foo")fieldendlet!(:integer_project_custom_field) do- field = create(:integer_project_custom_field, projects: [project], name: 'Integer field',+ field = create(:integer_project_custom_field, projects: [project], name: "Integer field",project_custom_field_section: section_for_input_fields)create(:custom_value, customized: project, custom_field: field, value: 123)@@ -110,7 +110,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:float_project_custom_field) do- field = create(:float_project_custom_field, projects: [project], name: 'Float field',+ field = create(:float_project_custom_field, projects: [project], name: "Float field",project_custom_field_section: section_for_input_fields)create(:custom_value, customized: project, custom_field: field, value: 123.456)@@ -119,7 +119,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:date_project_custom_field) do- field = create(:date_project_custom_field, projects: [project], name: 'Date field',+ field = create(:date_project_custom_field, projects: [project], name: "Date field",project_custom_field_section: section_for_input_fields)create(:custom_value, customized: project, custom_field: field, value: Date.new(2024, 1, 1))@@ -128,7 +128,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:text_project_custom_field) do- field = create(:text_project_custom_field, projects: [project], name: 'Text field',+ field = create(:text_project_custom_field, projects: [project], name: "Text field",project_custom_field_section: section_for_input_fields)create(:custom_value, customized: project, custom_field: field, value: "Lorem\n\nipsum")@@ -137,9 +137,9 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:list_project_custom_field) do- field = create(:list_project_custom_field, projects: [project], name: 'List field',+ field = create(:list_project_custom_field, projects: [project], name: "List field",project_custom_field_section: section_for_select_fields,- possible_values: ['Option 1', 'Option 2', 'Option 3'])+ possible_values: ["Option 1", "Option 2", "Option 3"])create(:custom_value, customized: project, custom_field: field, value: field.custom_options.first)@@ -147,7 +147,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:version_project_custom_field) do- field = create(:version_project_custom_field, projects: [project], name: 'Version field',+ field = create(:version_project_custom_field, projects: [project], name: "Version field",project_custom_field_section: section_for_select_fields)create(:custom_value, customized: project, custom_field: field, value: first_version.id)@@ -156,7 +156,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:user_project_custom_field) do- field = create(:user_project_custom_field, projects: [project], name: 'User field',+ field = create(:user_project_custom_field, projects: [project], name: "User field",project_custom_field_section: section_for_select_fields)create(:custom_value, customized: project, custom_field: field, value: member_in_project.id)@@ -165,9 +165,9 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:multi_list_project_custom_field) do- field = create(:list_project_custom_field, projects: [project], name: 'Multi list field',+ field = create(:list_project_custom_field, projects: [project], name: "Multi list field",project_custom_field_section: section_for_multi_select_fields,- possible_values: ['Option 1', 'Option 2', 'Option 3'],+ possible_values: ["Option 1", "Option 2", "Option 3"],multi_value: true)create(:custom_value, customized: project, custom_field: field, value: field.custom_options.first.id)@@ -177,7 +177,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:multi_version_project_custom_field) do- field = create(:version_project_custom_field, projects: [project], name: 'Multi version field',+ field = create(:version_project_custom_field, projects: [project], name: "Multi version field",project_custom_field_section: section_for_multi_select_fields,multi_value: true)@@ -188,7 +188,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:multi_user_project_custom_field) do- field = create(:user_project_custom_field, projects: [project], name: 'Multi user field',+ field = create(:user_project_custom_field, projects: [project], name: "Multi user field",project_custom_field_section: section_for_multi_select_fields,multi_value: true)@@ -226,7 +226,7 @@ RSpec.shared_context 'with seeded projects, members and project custom fields' dendlet!(:boolean_project_custom_field_activated_in_other_project) do- create(:boolean_project_custom_field, projects: [other_project], name: 'Other Boolean field',+ create(:boolean_project_custom_field, projects: [other_project], name: "Other Boolean field",project_custom_field_section: section_for_input_fields)endenddiff --git a/spec/features/projects/projects_custom_fields_spec.rb b/spec/features/projects/projects_custom_fields_spec.rbindex 60aba1edbcd..0685b6a0d29 100644--- a/spec/features/projects/projects_custom_fields_spec.rb+++ b/spec/features/projects/projects_custom_fields_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe 'Projects custom fields', :js, :with_cuprite do+RSpec.describe "Projects custom fields", :js, :with_cuprite doshared_let(:current_user) { create(:admin) }- shared_let(:project) { create(:project, name: 'Foo project', identifier: 'foo-project') }+ shared_let(:project) { create(:project, name: "Foo project", identifier: "foo-project") }let(:name_field) { FormFields::InputFormField.new :name }let(:identifier) { "[data-qa-field-name='customField#{custom_field.id}'] input[type=checkbox]" }@@ -38,33 +38,33 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite dologin_as current_userend- describe 'with version CF' do+ describe "with version CF" dolet!(:custom_field) docreate(:version_project_custom_field)endlet(:cf_field) { FormFields::SelectFormField.new custom_field }- it 'allows creating a new project (regression #29099)' do+ it "allows creating a new project (regression #29099)" dovisit new_project_path- name_field.set_value 'My project name'+ name_field.set_value "My project name"- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").clickcf_field.expect_visible- click_button 'Save'+ click_button "Save"expect(page).to have_current_path /\/projects\/my-project-name\/?/endend- describe 'with default values' do+ describe "with default values" dolet!(:default_int_custom_field) docreate(:integer_project_custom_field, default_value: 123)endlet!(:default_string_custom_field) do- create(:string_project_custom_field, default_value: 'lorem')+ create(:string_project_custom_field, default_value: "lorem")endlet!(:no_default_string_custom_field) docreate(:string_project_custom_field)@@ -75,19 +75,19 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite dolet(:default_string_field) { FormFields::InputFormField.new default_string_custom_field }let(:no_default_string_field) { FormFields::InputFormField.new no_default_string_custom_field }- it 'sets the default values on custom fields and allows overwriting them' do+ it "sets the default values on custom fields and allows overwriting them" dovisit new_project_path- name_field.set_value 'My project name'- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ name_field.set_value "My project name"+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").clickdefault_int_field.expect_value default_int_custom_field.default_value.to_sdefault_string_field.expect_value default_string_custom_field.default_value.to_s- no_default_string_field.expect_value ''+ no_default_string_field.expect_value ""- default_string_field.set_value 'Overwritten'+ default_string_field.set_value "Overwritten"- click_button 'Save'+ click_button "Save"expect(page).to have_current_path /\/projects\/my-project-name\/?/created_project = Project.last@@ -95,7 +95,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite dovisit project_settings_general_path(created_project)default_int_field.expect_value default_int_custom_field.default_value.to_s- default_string_field.expect_value 'Overwritten'+ default_string_field.expect_value "Overwritten"# The custom field without default value should not be shown# as it didn't got activated with a value during project creation@@ -103,7 +103,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doendend- describe 'with long text CF' do+ describe "with long text CF" dolet!(:custom_field) docreate(:text_project_custom_field)end@@ -114,92 +114,92 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doproject.project_custom_fields << custom_fieldend- it 'allows settings the project boolean CF (regression #26313)' do+ it "allows settings the project boolean CF (regression #26313)" dovisit project_settings_general_path(project.id)# expect CF, description and status description ckeditor-augmented-textarea- expect(page).to have_css('.op-ckeditor--wrapper', count: 3)+ expect(page).to have_css(".op-ckeditor--wrapper", count: 3)# single hash autocomplete- editor.insert_link 'http://example.org/link with spaces'+ editor.insert_link "http://example.org/link with spaces"sleep 2# Save project settings- click_on 'Save'+ click_on "Save"- expect(page).to have_text I18n.t('js.notice_successful_update')+ expect(page).to have_text I18n.t("js.notice_successful_update")project.reloadcv = project.custom_values.find_by(custom_field_id: custom_field.id).value- expect(cv).to include '[http://example.org/link with spaces](http://example.org/link%20with%20spaces)'+ expect(cv).to include "[http://example.org/link with spaces](http://example.org/link%20with%20spaces)"expect(page).to have_css('a[href="http://example.org/link with spaces"]')endend- describe 'with float CF' do+ describe "with float CF" dolet!(:float_cf) do- create(:float_project_custom_field, name: 'MyFloat')+ create(:float_project_custom_field, name: "MyFloat")endlet(:float_field) { FormFields::InputFormField.new float_cf }- context 'with english locale' do- let(:current_user) { create(:admin, language: 'en') }+ context "with english locale" do+ let(:current_user) { create(:admin, language: "en") }- it 'displays the float with english locale' do+ it "displays the float with english locale" dovisit new_project_path- name_field.set_value 'My project name'- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ name_field.set_value "My project name"+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").click- float_field.set_value '10000.55'+ float_field.set_value "10000.55"# Save project settings- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/my-project-name\/?/- project = Project.find_by(name: 'My project name')+ project = Project.find_by(name: "My project name")cv = project.custom_values.find_by(custom_field_id: float_cf.id).typed_valueexpect(cv).to eq 10000.55visit project_settings_general_path(project)- float_field.expect_value '10000.55'+ float_field.expect_value "10000.55"endend- context 'with german locale',+ context "with german locale",driver: :firefox_de,with_cuprite: false do- let(:current_user) { create(:admin, language: 'de') }+ let(:current_user) { create(:admin, language: "de") }- it 'displays the float with german locale' do+ it "displays the float with german locale" doI18n.locale = :devisit new_project_path- name_field.set_value 'My project name'- find('.op-fieldset--toggle', text: I18n.t('js.forms.advanced_settings').upcase).click+ name_field.set_value "My project name"+ find(".op-fieldset--toggle", text: I18n.t("js.forms.advanced_settings").upcase).click- float_field.set_value '10000,55'+ float_field.set_value "10000,55"# Save project settings- click_on I18n.t('js.button_save')+ click_on I18n.t("js.button_save")expect(page).to have_current_path /\/projects\/my-project-name\/?/- project = Project.find_by(name: 'My project name')+ project = Project.find_by(name: "My project name")cv = project.custom_values.find_by(custom_field_id: float_cf.id).typed_valueexpect(cv).to eq 10000.55visit project_settings_general_path(project)# The field renders in german locale, but there's no way to test that# as the internal value is always english locale- float_field.expect_value '10000.55'+ float_field.expect_value "10000.55"endendend- describe 'with boolean CF' do+ describe "with boolean CF" dolet!(:custom_field) docreate(:boolean_project_custom_field)end@@ -209,14 +209,14 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doproject.project_custom_fields << custom_fieldend- it 'allows settings the project boolean CF (regression #26313)' do+ it "allows settings the project boolean CF (regression #26313)" dovisit project_settings_general_path(project.id)field = page.find(identifier)expect(field).not_to be_checkedfield.check- click_on 'Save'+ click_on "Save"expect(page).to have_text I18n.t(:notice_successful_update)field = page.find(identifier)@@ -224,7 +224,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doendend- describe 'with user CF' do+ describe "with user CF" dolet!(:custom_field) docreate(:user_project_custom_field)end@@ -234,9 +234,9 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite dolet!(:existing_project) { create(:project) }# Assume one user is visible- let!(:invisible_user) { create(:user, firstname: 'Invisible', lastname: 'User') }+ let!(:invisible_user) { create(:user, firstname: "Invisible", lastname: "User") }let!(:visible_user) do- create(:user, firstname: 'Visible', lastname: 'User',+ create(:user, firstname: "Visible", lastname: "User",member_with_permissions: { existing_project => %i[view_work_packages edit_work_packages] })end@@ -246,29 +246,29 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doComponents::Users::InviteUserModal.new project:,principal: invisible_user,role:,- invite_message: 'you are invited'+ invite_message: "you are invited"end- it 'allows setting a visible user CF (regression #26313)' do+ it "allows setting a visible user CF (regression #26313)" dovisit new_project_path- name_field.set_value 'My project name'+ name_field.set_value "My project name"- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").clickcf_field.expect_visiblecf_field.expect_no_option invisible_usercf_field.select_option visible_user- click_on 'Save'+ click_on "Save"expect(page).to have_current_path /\/projects\/my-project-name\/?/- project = Project.find_by(name: 'My project name')+ project = Project.find_by(name: "My project name")cv = project.custom_values.find_by(custom_field_id: custom_field.id).typed_valueexpect(cv).to eq visible_userend- it 'allows inviting a new user immediately (regression #39166)' do+ it "allows inviting a new user immediately (regression #39166)" doproject.project_custom_fields << custom_field # enable the custom field for the projectvisit project_settings_general_path(project.id)@@ -277,17 +277,17 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite docf_field.expect_no_option invisible_user# Invite the other user to the project- find('.ng-dropdown-footer button', text: 'Invite', wait: 5).click+ find(".ng-dropdown-footer button", text: "Invite", wait: 5).clickmodal.run_all_stepssleep 2# The newly invited user can be directly selectedcf_field.expect_visible- cf_field.search('invis')+ cf_field.search("invis")cf_field.select_option invisible_user- click_on 'Save'+ click_on "Save"expect(page).to have_text I18n.t(:notice_successful_update)project.reload@@ -295,16 +295,16 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite doexpect(cv).to eq invisible_userend- it 'does not show invite user button when there is no project selected' do+ it "does not show invite user button when there is no project selected" dovisit new_project_path- name_field.set_value 'My project name'+ name_field.set_value "My project name"- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click+ find(".op-fieldset--toggle", text: "ADVANCED SETTINGS").clickcf_field.expect_visiblecf_field.expect_no_option invisible_user- expect(page).to have_no_css('.ng-dropdown-footer button', text: 'Invite')+ expect(page).to have_no_css(".ng-dropdown-footer button", text: "Invite")endendenddiff --git a/spec/features/users/my_spec.rb b/spec/features/users/my_spec.rbindex 500d91cd84c..53ff55f7994 100644--- a/spec/features/users/my_spec.rb+++ b/spec/features/users/my_spec.rb@@ -26,15 +26,15 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe 'my', :js, :with_cuprite do- let(:user_password) { 'bob' * 4 }- let!(:string_cf) { create(:user_custom_field, :string, name: 'Hobbies', is_required: false) }+RSpec.describe "my", :js, :with_cuprite do+ let(:user_password) { "bob" * 4 }+ let!(:string_cf) { create(:user_custom_field, :string, name: "Hobbies", is_required: false) }let(:user) docreate(:user,- mail: '[email protected]',- login: 'bob',+ mail: "[email protected]",+ login: "bob",password: user_password,password_confirmation: user_password)end@@ -46,218 +46,218 @@ RSpec.describe 'my', :js, :with_cuprite doexpect(page).to have_content I18n.t(:notice_account_other_session_expired)# expect session to be removed- expect(Sessions::UserSession.for_user(user).where(session_id: 'other').count).to eq 0+ expect(Sessions::UserSession.for_user(user).where(session_id: "other").count).to eq 0user.reload- expect(user.mail).to eq '[email protected]'- expect(user.name).to eq 'Foo Bar'+ expect(user.mail).to eq "[email protected]"+ expect(user.name).to eq "Foo Bar"endbefore dologin_as user# Create dangling session- session = Sessions::SqlBypass.new data: { user_id: user.id }, session_id: 'other'+ session = Sessions::SqlBypass.new data: { user_id: user.id }, session_id: "other"session.save- expect(Sessions::UserSession.for_user(user).where(session_id: 'other').count).to eq 1+ expect(Sessions::UserSession.for_user(user).where(session_id: "other").count).to eq 1end- shared_examples 'common tests for normal and LDAP user' do- describe 'settings' do- context 'with a default time zone', with_settings: { user_default_timezone: 'Asia/Tokyo' } do- it 'can override a time zone' do- expect(user.pref.time_zone).to eq 'Asia/Tokyo'+ shared_examples "common tests for normal and LDAP user" do+ describe "settings" do+ context "with a default time zone", with_settings: { user_default_timezone: "Asia/Tokyo" } do+ it "can override a time zone" do+ expect(user.pref.time_zone).to eq "Asia/Tokyo"visit my_settings_path- expect(page).to have_select 'pref_time_zone', selected: '(UTC+09:00) Tokyo'- select '(UTC+01:00) Paris', from: 'pref_time_zone'- click_on 'Save'+ expect(page).to have_select "pref_time_zone", selected: "(UTC+09:00) Tokyo"+ select "(UTC+01:00) Paris", from: "pref_time_zone"+ click_on "Save"- expect(page).to have_select 'pref_time_zone', selected: '(UTC+01:00) Paris'- expect(user.pref.time_zone).to eq 'Europe/Paris'+ expect(page).to have_select "pref_time_zone", selected: "(UTC+01:00) Paris"+ expect(user.pref.time_zone).to eq "Europe/Paris"endendendend- context 'user' do- describe '#account' do+ context "user" do+ describe "#account" dolet(:dialog) { Components::PasswordConfirmationDialog.new }before dovisit my_account_path- fill_in 'user[mail]', with: '[email protected]'- fill_in 'user[firstname]', with: 'Foo'- fill_in 'user[lastname]', with: 'Bar'- click_on 'Save'+ fill_in "user[mail]", with: "[email protected]"+ fill_in "user[firstname]", with: "Foo"+ fill_in "user[lastname]", with: "Bar"+ click_on "Save"end- context 'when confirmation disabled',+ context "when confirmation disabled",with_config: { internal_password_confirmation: false } do- it 'does not request confirmation' do+ it "does not request confirmation" doexpect_changed!endend- context 'when confirmation required',+ context "when confirmation required",with_config: { internal_password_confirmation: true } do- it 'requires the password for a regular user' do+ it "requires the password for a regular user" dodialog.confirm_flow_with(user_password)expect_changed!end- it 'declines the change when invalid password is given' do- dialog.confirm_flow_with(user_password + 'INVALID', should_fail: true)+ it "declines the change when invalid password is given" do+ dialog.confirm_flow_with(user_password + "INVALID", should_fail: true)user.reload- expect(user.mail).to eq('[email protected]')+ expect(user.mail).to eq("[email protected]")end- context 'as admin' do+ context "as admin" doshared_let(:admin) { create(:admin) }let(:user) { admin }- it 'requires the password' do- dialog.confirm_flow_with('adminADMIN!')+ it "requires the password" do+ dialog.confirm_flow_with("adminADMIN!")expect_changed!endendendend- include_examples 'common tests for normal and LDAP user'+ include_examples "common tests for normal and LDAP user"describe "API tokens" do- context 'when API access is disabled via global settings', with_settings: { rest_api_enabled: false } do- it 'shows notice about disabled token' do+ context "when API access is disabled via global settings", with_settings: { rest_api_enabled: false } do+ it "shows notice about disabled token" dovisit my_access_token_path- within '#api-token-section' do- expect(page).to have_content('API tokens are not enabled by the administrator.')- expect(page).not_to have_test_selector('api-token-add', text: 'API token')+ within "#api-token-section" do+ expect(page).to have_content("API tokens are not enabled by the administrator.")+ expect(page).not_to have_test_selector("api-token-add", text: "API token")endendend- context 'when API access is enabled via global settings', with_settings: { rest_api_enabled: true } do- it 'API tokens can generated and revoked' do+ context "when API access is enabled via global settings", with_settings: { rest_api_enabled: true } do+ it "API tokens can generated and revoked" dovisit my_access_token_path- expect(page).to have_no_content('API tokens are not enabled by the administrator.')+ expect(page).to have_no_content("API tokens are not enabled by the administrator.")- within '#api-token-section' do- expect(page).to have_test_selector('api-token-add', text: 'API token')+ within "#api-token-section" do+ expect(page).to have_test_selector("api-token-add", text: "API token")find_test_selector("api-token-add").clickend- expect(page).to have_content 'A new API token has been generated. Your access token is'+ expect(page).to have_content "A new API token has been generated. Your access token is"User.current.reloadvisit my_access_token_path# only one API token can be created- within '#api-token-section' do- expect(page).not_to have_test_selector('api-token-add', text: 'API token')+ within "#api-token-section" do+ expect(page).not_to have_test_selector("api-token-add", text: "API token")end# revoke API token- within '#api-token-section' do+ within "#api-token-section" doaccept_confirm dofind_test_selector("api-token-revoke").clickendend- expect(page).to have_content 'The API token has been deleted.'+ expect(page).to have_content "The API token has been deleted."User.current.reloadvisit my_access_token_path# API token can be created again- within '#api-token-section' do- expect(page).to have_test_selector('api-token-add', text: 'API token')+ within "#api-token-section" do+ expect(page).to have_test_selector("api-token-add", text: "API token")endendendenddescribe "RSS tokens" do- context 'when RSS access is disabled via global settings', with_settings: { feeds_enabled: false } do- it 'shows notice about disabled token' do+ context "when RSS access is disabled via global settings", with_settings: { feeds_enabled: false } do+ it "shows notice about disabled token" dovisit my_access_token_path- within '#rss-token-section' do- expect(page).to have_content('RSS tokens are not enabled by the administrator.')- expect(page).not_to have_test_selector('rss-token-add', text: 'RSS token')+ within "#rss-token-section" do+ expect(page).to have_content("RSS tokens are not enabled by the administrator.")+ expect(page).not_to have_test_selector("rss-token-add", text: "RSS token")endendend- context 'when RSS access is enabled via global settings', with_settings: { feeds_enabled: true } do- it 'in Access Tokens they can generate and revoke their RSS key' do+ context "when RSS access is enabled via global settings", with_settings: { feeds_enabled: true } do+ it "in Access Tokens they can generate and revoke their RSS key" dovisit my_access_token_path- expect(page).to have_no_content('RSS tokens are not enabled by the administrator.')+ expect(page).to have_no_content("RSS tokens are not enabled by the administrator.")- within '#rss-token-section' do- expect(page).to have_test_selector('rss-token-add', text: 'RSS token')+ within "#rss-token-section" do+ expect(page).to have_test_selector("rss-token-add", text: "RSS token")find_test_selector("rss-token-add").clickend- expect(page).to have_content 'A new RSS token has been generated. Your access token is'+ expect(page).to have_content "A new RSS token has been generated. Your access token is"User.current.reloadvisit my_access_token_path# only one RSS token can be created- within '#rss-token-section' do- expect(page).not_to have_test_selector('rss-token-add', text: 'RSS token')+ within "#rss-token-section" do+ expect(page).not_to have_test_selector("rss-token-add", text: "RSS token")end# revoke RSS token- within '#rss-token-section' do+ within "#rss-token-section" doaccept_confirm dofind_test_selector("rss-token-revoke").clickendend- expect(page).to have_content 'The RSS token has been deleted.'+ expect(page).to have_content "The RSS token has been deleted."User.current.reloadvisit my_access_token_path# RSS token can be created again- within '#rss-token-section' do- expect(page).to have_test_selector('rss-token-add', text: 'RSS token')+ within "#rss-token-section" do+ expect(page).to have_test_selector("rss-token-add", text: "RSS token")endendendenddescribe "iCalendar tokens" do- context 'when iCalendar access is disabled via global settings', with_settings: { ical_enabled: false } do- it 'shows notice about disabled token' do+ context "when iCalendar access is disabled via global settings", with_settings: { ical_enabled: false } do+ it "shows notice about disabled token" dovisit my_access_token_path- within '#icalendar-token-section' do- expect(page).to have_content('iCalendar subscriptions are not enabled by the administrator.')+ within "#icalendar-token-section" do+ expect(page).to have_content("iCalendar subscriptions are not enabled by the administrator.")endendend- context 'when iCalendar access is enable via global settings', with_settings: { ical_enabled: true } do- context 'when no iCalendar token exists' do- it 'shows notice about how to use iCalendar tokens' do+ context "when iCalendar access is enable via global settings", with_settings: { ical_enabled: true } do+ context "when no iCalendar token exists" do+ it "shows notice about how to use iCalendar tokens" dovisit my_access_token_path- within '#icalendar-token-section' do- expect(page).to have_content('To add an iCalendar token') # ...+ within "#icalendar-token-section" do+ expect(page).to have_content("To add an iCalendar token") # ...endendend- context 'when multiple iCalendar tokens exist' do+ context "when multiple iCalendar tokens exist" dolet!(:project) { create(:project) }let!(:query) { create(:query, project:) }let!(:another_query) { create(:query, project:) }@@ -265,12 +265,12 @@ RSpec.describe 'my', :js, :with_cuprite dolet!(:ical_token_for_another_query) { create(:ical_token, user:, query: another_query, name: "Second Token Name") }let!(:second_ical_token_for_query) { create(:ical_token, user:, query:, name: "Third Token Name") }- it 'shows iCalendar tokens with their calender and project info' do+ it "shows iCalendar tokens with their calender and project info" dovisit my_access_token_path- expect(page).to have_no_content('To add an iCalendar token') # ...+ expect(page).to have_no_content("To add an iCalendar token") # ...- within '#icalendar-token-section' do+ within "#icalendar-token-section" do[ical_token_for_query,ical_token_for_another_query,@@ -287,21 +287,21 @@ RSpec.describe 'my', :js, :with_cuprite doendend- it 'single iCalendar tokens can be deleted' do+ it "single iCalendar tokens can be deleted" dovisit my_access_token_path- within '#icalendar-token-section' do+ within "#icalendar-token-section" doaccept_confirm dofind_test_selector("ical-token-row-#{ical_token_for_query.id}-revoke").clickendend- expect(page).to have_content 'The iCalendar URL with this token is now invalid.'+ expect(page).to have_content "The iCalendar URL with this token is now invalid."User.current.reloadvisit my_access_token_path- within '#icalendar-token-section' do+ within "#icalendar-token-section" doexpect(page).not_to have_test_selector('ical-token-row-#{ical_token_for_query.id}-revoke')endend@@ -310,20 +310,20 @@ RSpec.describe 'my', :js, :with_cuprite doenddescribe "OAuth tokens" do- context 'when no OAuth access is configured' do- it 'shows notice about no existing tokens' do+ context "when no OAuth access is configured" do+ it "shows notice about no existing tokens" dovisit my_access_token_path- within '#oauth-token-section' do- expect(page).to have_content('There is no third-party application access configured and active for you')+ within "#oauth-token-section" do+ expect(page).to have_content("There is no third-party application access configured and active for you")endendend- context 'when OAuth access is configured' do+ context "when OAuth access is configured" dolet!(:app) docreate(:oauth_application,- name: 'Some App',+ name: "Some App",confidential: false)endlet!(:token_for_app) do@@ -333,8 +333,8 @@ RSpec.describe 'my', :js, :with_cuprite doendlet!(:second_app) docreate(:oauth_application,- name: 'Some Second App',- uid: '56789',+ name: "Some Second App",+ uid: "56789",confidential: false)endlet!(:token_for_second_app) do@@ -343,23 +343,23 @@ RSpec.describe 'my', :js, :with_cuprite doresource_owner: user)end- context 'when single OAuth token per app is configured' do- it 'shows token for granted applications' do+ context "when single OAuth token per app is configured" do+ it "shows token for granted applications" dovisit my_access_token_path[app, second_app].each do |app|- within '#oauth-token-section' do+ within "#oauth-token-section" doexpect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: app.name)- expect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: '(one active token)')+ expect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: "(one active token)")endendend- it 'can revoke tokens' do+ it "can revoke tokens" dovisit my_access_token_path[app, second_app].each do |app|- within '#oauth-token-section' do+ within "#oauth-token-section" doaccept_confirm dofind_test_selector("oauth-token-row-#{app.id}-revoke").clickend@@ -370,14 +370,14 @@ RSpec.describe 'my', :js, :with_cuprite dovisit my_access_token_path[app, second_app].each do |app|- within '#oauth-token-section' do+ within "#oauth-token-section" doexpect(page).not_to have_test_selector("oauth-token-row-#{app.id}-revoke")endendendend- context 'when multiple OAuth tokens per app are configured' do+ context "when multiple OAuth tokens per app are configured" dolet!(:second_token_for_app) docreate(:oauth_access_token,application: app,@@ -389,21 +389,21 @@ RSpec.describe 'my', :js, :with_cuprite doresource_owner: user)end- it 'shows token for granted applications' do+ it "shows token for granted applications" dovisit my_access_token_path[app, second_app].each do |app|- within '#oauth-token-section' do+ within "#oauth-token-section" doexpect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: app.name)- expect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: '(2 active token)')+ expect(page).to have_test_selector("oauth-token-row-#{app.id}-name", text: "(2 active token)")endendend- it 'can revoke mutliple tokens per app' do+ it "can revoke mutliple tokens per app" dovisit my_access_token_path- within '#oauth-token-section' do+ within "#oauth-token-section" doaccept_confirm dofind_test_selector("oauth-token-row-#{app.id}-revoke").clickend@@ -412,7 +412,7 @@ RSpec.describe 'my', :js, :with_cuprite doUser.current.reloadvisit my_access_token_path- within '#oauth-token-section' do+ within "#oauth-token-section" doexpect(page).not_to have_test_selector("oauth-token-row-#{app.id}-revoke")endend@@ -422,43 +422,43 @@ RSpec.describe 'my', :js, :with_cuprite doend# Without password confirmation the test doesn't try to connect to the LDAP:- context 'LDAP user', with_config: { internal_password_confirmation: false } do+ context "LDAP user", with_config: { internal_password_confirmation: false } dolet(:ldap_auth_source) { create(:ldap_auth_source) }let(:user) docreate(:user,- mail: '[email protected]',- login: 'bob',+ mail: "[email protected]",+ login: "bob",ldap_auth_source:)end- describe '#account' do+ describe "#account" dobefore dovisit my_account_pathend- it 'does not allow change of name and email but other fields can be changed' do- email_field = find_field('user[mail]', disabled: true)- firstname_field = find_field('user[firstname]', disabled: true)- lastname_field = find_field('user[lastname]', disabled: true)+ it "does not allow change of name and email but other fields can be changed" do+ email_field = find_field("user[mail]", disabled: true)+ firstname_field = find_field("user[firstname]", disabled: true)+ lastname_field = find_field("user[lastname]", disabled: true)expect(email_field).to be_disabledexpect(firstname_field).to be_disabledexpect(lastname_field).to be_disabled- expect(page).to have_text(I18n.t('user.text_change_disabled_for_ldap_login'), count: 3)+ expect(page).to have_text(I18n.t("user.text_change_disabled_for_ldap_login"), count: 3)- fill_in 'Hobbies', with: 'Ruby, DCS'- uncheck 'pref[hide_mail]'- click_on 'Save'+ fill_in "Hobbies", with: "Ruby, DCS"+ uncheck "pref[hide_mail]"+ click_on "Save"expect(page).to have_content I18n.t(:notice_account_updated)user.reload- expect(user.custom_values.find_by(custom_field_id: string_cf).value).to eql 'Ruby, DCS'+ expect(user.custom_values.find_by(custom_field_id: string_cf).value).to eql "Ruby, DCS"expect(user.pref.hide_mail).to be falseendend- include_examples 'common tests for normal and LDAP user'+ include_examples "common tests for normal and LDAP user"endenddiff --git a/spec/models/custom_value_spec.rb b/spec/models/custom_value_spec.rbindex 47966bc810f..47f735b1bfb 100644--- a/spec/models/custom_value_spec.rb+++ b/spec/models/custom_value_spec.rb@@ -26,16 +26,16 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe CustomValue doshared_let(:version) { create(:version) }- let(:format) { 'bool' }+ let(:format) { "bool" }let(:custom_field) { create(:version_custom_field, field_format: format) }let(:custom_value) { create(:custom_value, custom_field:, value:, customized: version) }- describe '#typed_value' do+ describe "#typed_value" dosubject { custom_value }before do@@ -44,68 +44,68 @@ RSpec.describe CustomValue dosubject.reloadend- describe 'boolean custom value' do- let(:format) { 'bool' }+ describe "boolean custom value" do+ let(:format) { "bool" }let(:value) { true }- context 'when it is true' do+ context "when it is true" doit { expect(subject.typed_value).to eql(value) }end- context 'when it is false' do+ context "when it is false" dolet(:value) { false }it { expect(subject.typed_value).to eql(value) }end- context 'when it is nil' do+ context "when it is nil" dolet(:value) { nil }it { expect(subject.typed_value).to eql(value) }endend- describe 'string custom value' do- let(:format) { 'string' }- let(:value) { 'This is a string!' }+ describe "string custom value" do+ let(:format) { "string" }+ let(:value) { "This is a string!" }it { expect(subject.typed_value).to eql(value) }end- describe 'integer custom value' do- let(:format) { 'int' }+ describe "integer custom value" do+ let(:format) { "int" }let(:value) { 123 }it { expect(subject.typed_value).to eql(value) }end- describe 'float custom value' do- let(:format) { 'float' }+ describe "float custom value" do+ let(:format) { "float" }let(:value) { 3.147 }it { expect(subject.typed_value).to eql(value) }end- describe 'date custom value' do- let(:format) { 'date' }+ describe "date custom value" do+ let(:format) { "date" }let(:value) { Date.new(2016, 12, 1) }it { expect(subject.typed_value).to eql(value) }- context 'for a date format', with_settings: { date_format: '%Y/%m/%d' } do- it { expect(subject.formatted_value).to eq('2016/12/01') }+ context "for a date format", with_settings: { date_format: "%Y/%m/%d" } do+ it { expect(subject.formatted_value).to eq("2016/12/01") }endendend- describe '#default?' do+ describe "#default?" doshared_let(:project) { create(:project) }RSpec::Matchers.define_negated_matcher :not_be_default, :be_default- shared_examples 'returns true for generated custom value' do+ shared_examples "returns true for generated custom value" dodescribe "for a generated custom value" do- it 'returns true' do+ it "returns true" docustom_values = project.custom_field_valuesexpect(custom_values.count).to eq(1)@@ -114,9 +114,9 @@ RSpec.describe CustomValue doendend- shared_examples 'returns false for custom value with value' do |value:|+ shared_examples "returns false for custom value with value" do |value:|describe "for a custom value with #{value.inspect} value" do- it 'returns false' do+ it "returns false" doproject.send(custom_field.attribute_setter, value)custom_value = project.custom_values.last@@ -125,22 +125,22 @@ RSpec.describe CustomValue doendend- context 'for a boolean custom field without default value' do+ context "for a boolean custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :boolean, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: false- include_examples 'returns false for custom value with value', value: true+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: false+ include_examples "returns false for custom value with value", value: trueend- context 'for a boolean custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do+ context "for a boolean custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" docreate(:project_custom_field, :boolean, default_value: true)create(:project_custom_field, :boolean, default_value: false)# the admin interface saves default value as "1" (checked) or "0" (unchecked)- create(:project_custom_field, :boolean, default_value: '1')- create(:project_custom_field, :boolean, default_value: '0')+ create(:project_custom_field, :boolean, default_value: "1")+ create(:project_custom_field, :boolean, default_value: "0")custom_values = project.custom_field_values@@ -152,15 +152,15 @@ RSpec.describe CustomValue docontext "for a string custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :string, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: 'Hello world!'+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: "Hello world!"end- context 'for a string custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do- create(:project_custom_field, :string, default_value: 'Hello world!', projects: [project])- create(:project_custom_field, :string, default_value: '', projects: [project])+ context "for a string custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" do+ create(:project_custom_field, :string, default_value: "Hello world!", projects: [project])+ create(:project_custom_field, :string, default_value: "", projects: [project])custom_values = project.custom_field_values@@ -169,19 +169,19 @@ RSpec.describe CustomValue doendend- context 'for a text custom field without default value' do+ context "for a text custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :text, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: "Hello world!"- include_examples 'returns false for custom value with value', value: "Hello world!\nHello world!\nHello world!"+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: "Hello world!"+ include_examples "returns false for custom value with value", value: "Hello world!\nHello world!\nHello world!"end- context 'for a text custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do- create(:project_custom_field, :text, default_value: 'Hello world!', projects: [project])- create(:project_custom_field, :text, default_value: '', projects: [project])+ context "for a text custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" do+ create(:project_custom_field, :text, default_value: "Hello world!", projects: [project])+ create(:project_custom_field, :text, default_value: "", projects: [project])custom_values = project.custom_field_values@@ -190,23 +190,23 @@ RSpec.describe CustomValue doendend- context 'for an integer custom field without default value' do+ context "for an integer custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :integer, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: 123- include_examples 'returns false for custom value with value', value: 0- include_examples 'returns false for custom value with value', value: -12+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: 123+ include_examples "returns false for custom value with value", value: 0+ include_examples "returns false for custom value with value", value: -12end- context 'for an integer custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do+ context "for an integer custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" docreate(:project_custom_field, :integer, default_value: 0, projects: [project])create(:project_custom_field, :integer, default_value: 123, projects: [project])- create(:project_custom_field, :integer, default_value: '456', projects: [project])+ create(:project_custom_field, :integer, default_value: "456", projects: [project])create(:project_custom_field, :integer, default_value: -987, projects: [project])- create(:project_custom_field, :integer, default_value: '-678', projects: [project])+ create(:project_custom_field, :integer, default_value: "-678", projects: [project])custom_values = project.custom_field_values@@ -215,23 +215,23 @@ RSpec.describe CustomValue doendend- context 'for a float custom field without default value' do+ context "for a float custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :float, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: 3.14- include_examples 'returns false for custom value with value', value: 0- include_examples 'returns false for custom value with value', value: -12+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: 3.14+ include_examples "returns false for custom value with value", value: 0+ include_examples "returns false for custom value with value", value: -12end- context 'for a float custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do+ context "for a float custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" docreate(:project_custom_field, :float, default_value: 0.0, projects: [project])create(:project_custom_field, :float, default_value: 12.3, projects: [project])- create(:project_custom_field, :float, default_value: '45.6', projects: [project])+ create(:project_custom_field, :float, default_value: "45.6", projects: [project])create(:project_custom_field, :float, default_value: -98.7, projects: [project])- create(:project_custom_field, :float, default_value: '-67', projects: [project])+ create(:project_custom_field, :float, default_value: "-67", projects: [project])custom_values = project.custom_field_values@@ -240,22 +240,22 @@ RSpec.describe CustomValue doendend- context 'for a date custom field' do+ context "for a date custom field" doshared_let(:custom_field) { create(:project_custom_field, :date, projects: [project]) }- include_examples 'returns true for generated custom value'- include_examples 'returns false for custom value with value', value: "2023-08-08"- include_examples 'returns false for custom value with value', value: Date.current+ include_examples "returns true for generated custom value"+ include_examples "returns false for custom value with value", value: "2023-08-08"+ include_examples "returns false for custom value with value", value: Date.currentend- context 'for a list custom field without default value' do+ context "for a list custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :list, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"describe "for a custom value with option 'B' selected" do- it 'returns false' do- project.send(custom_field.attribute_setter, custom_field.value_of('B'))+ it "returns false" do+ project.send(custom_field.attribute_setter, custom_field.value_of("B"))custom_value = project.custom_values.lastexpect(custom_value).to not_be_default@@ -263,10 +263,10 @@ RSpec.describe CustomValue doendend- context 'for a list custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do- create(:project_custom_field, :list, default_option: 'B', projects: [project])+ context "for a list custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" do+ create(:project_custom_field, :list, default_option: "B", projects: [project])custom_values = project.custom_field_values@@ -276,14 +276,14 @@ RSpec.describe CustomValue doendend- context 'for a multi-value list custom field without default value' do+ context "for a multi-value list custom field without default value" doshared_let(:custom_field) { create(:project_custom_field, :multi_list, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"describe "for a custom value with option 'B' and 'D' selected" do- it 'returns false' do- project.send(custom_field.attribute_setter, [custom_field.value_of('B'), custom_field.value_of('D')])+ it "returns false" do+ project.send(custom_field.attribute_setter, [custom_field.value_of("B"), custom_field.value_of("D")])project.save!expect(project.custom_values).to all(not_be_default)@@ -291,11 +291,11 @@ RSpec.describe CustomValue doendend- context 'for a multi-value list custom field with default value' do- describe 'for a generated custom value' do- it 'returns true' do- create(:project_custom_field, :multi_list, default_options: ['B'], projects: [project])- create(:project_custom_field, :multi_list, default_options: ['G', 'B', 'C'], projects: [project])+ context "for a multi-value list custom field with default value" do+ describe "for a generated custom value" do+ it "returns true" do+ create(:project_custom_field, :multi_list, default_options: ["B"], projects: [project])+ create(:project_custom_field, :multi_list, default_options: ["G", "B", "C"], projects: [project])custom_values = project.custom_field_values@@ -306,15 +306,15 @@ RSpec.describe CustomValue doendend- context 'for a version custom field' do+ context "for a version custom field" doshared_let(:custom_field) { create(:project_custom_field, :version, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"- describe 'for a custom value with a version selected' do- let!(:version_turfu) { create(:version, name: 'turfu', project:) }+ describe "for a custom value with a version selected" do+ let!(:version_turfu) { create(:version, name: "turfu", project:) }- it 'returns false' do+ it "returns false" doproject.send(custom_field.attribute_setter, version_turfu.id)project.save!custom_value = project.custom_values.last@@ -324,16 +324,16 @@ RSpec.describe CustomValue doendend- context 'for a multi version custom field' do+ context "for a multi version custom field" doshared_let(:custom_field) { create(:project_custom_field, :multi_version, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"- describe 'for a custom value with multiple versions selected' do- let!(:version_ringbo) { create(:version, name: 'ringbo', project:) }- let!(:version_turfu) { create(:version, name: 'turfu', project:) }+ describe "for a custom value with multiple versions selected" do+ let!(:version_ringbo) { create(:version, name: "ringbo", project:) }+ let!(:version_turfu) { create(:version, name: "turfu", project:) }- it 'returns false' do+ it "returns false" doproject.send(custom_field.attribute_setter, [version_ringbo.id, version_turfu.id])project.save!@@ -342,17 +342,17 @@ RSpec.describe CustomValue doendend- context 'for a user custom field' do+ context "for a user custom field" doshared_let(:custom_field) { create(:project_custom_field, :user, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"- describe 'for a custom value with a user selected' do+ describe "for a custom value with a user selected" dolet!(:alice) do- create(:user, firstname: 'Alice', member_with_permissions: { project => %i[view_work_packages edit_work_packages] })+ create(:user, firstname: "Alice", member_with_permissions: { project => %i[view_work_packages edit_work_packages] })end- it 'returns false' do+ it "returns false" doproject.send(custom_field.attribute_setter, alice.id)project.save!custom_value = project.custom_values.last@@ -362,20 +362,20 @@ RSpec.describe CustomValue doendend- context 'for a multi user custom field' do+ context "for a multi user custom field" doshared_let(:custom_field) { create(:project_custom_field, :multi_user, projects: [project]) }- include_examples 'returns true for generated custom value'+ include_examples "returns true for generated custom value"- describe 'for a custom value with multiple users selected' do+ describe "for a custom value with multiple users selected" dolet!(:alice) do- create(:user, firstname: 'Alice', member_with_permissions: { project => %i[view_work_packages edit_work_packages] })+ create(:user, firstname: "Alice", member_with_permissions: { project => %i[view_work_packages edit_work_packages] })endlet!(:bob) do- create(:user, firstname: 'Bob', member_with_permissions: { project => %i[view_work_packages edit_work_packages] })+ create(:user, firstname: "Bob", member_with_permissions: { project => %i[view_work_packages edit_work_packages] })end- it 'returns false' do+ it "returns false" doproject.send(custom_field.attribute_setter, [alice.id, bob.id])project.save!@@ -385,18 +385,18 @@ RSpec.describe CustomValue doendend- describe 'trying to use a custom field that does not exist' do- subject { build(:custom_value, custom_field_id: 123412341, value: 'my value') }+ describe "trying to use a custom field that does not exist" do+ subject { build(:custom_value, custom_field_id: 123412341, value: "my value") }- it 'returns an empty placeholder' do+ it "returns an empty placeholder" doexpect(subject.custom_field).to be_nilexpect(subject.send(:strategy)).to be_a CustomValue::EmptyStrategy- expect(subject.typed_value).to eq 'my value not found'- expect(subject.formatted_value).to eq 'my value not found'+ expect(subject.typed_value).to eq "my value not found"+ expect(subject.formatted_value).to eq "my value not found"endend- describe '#valid?' do+ describe "#valid?" dolet(:custom_field) dobuild_stubbed(:custom_field, field_format:, is_required:, min_length:, max_length:, regexp:)end@@ -406,304 +406,304 @@ RSpec.describe CustomValue dolet(:max_length) { 0 }let(:regexp) { nil }- context 'for a data custom field' do- let(:field_format) { 'date' }+ context "for a data custom field" do+ let(:field_format) { "date" }- context 'with a valid date' do- let(:value) { '1975-07-14' }+ context "with a valid date" do+ let(:value) { "1975-07-14" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with some non date string' do- let(:value) { 'abc' }+ context "with some non date string" do+ let(:value) { "abc" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendendend- context 'for a string custom field' do- let(:field_format) { 'string' }+ context "for a string custom field" do+ let(:field_format) { "string" }- context 'with some string' do- let(:value) { 'abc' }+ context "with some string" do+ let(:value) { "abc" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).to be_validendend- context 'with a nil value' do+ context "with a nil value" dolet(:value) { nil }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with an empty value' do- let(:value) { '' }+ context "with an empty value" do+ let(:value) { "" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a nil value when required' do+ context "with a nil value when required" dolet(:value) { nil }let(:is_required) { true }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with an empty value when required' do- let(:value) { '' }+ context "with an empty value when required" do+ let(:value) { "" }let(:is_required) { true }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with an empty value when having a min_length' do- let(:value) { '' }+ context "with an empty value when having a min_length" do+ let(:value) { "" }let(:min_length) { 1 }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with too short a value when having a min_length' do- let(:value) { 'a' }+ context "with too short a value when having a min_length" do+ let(:value) { "a" }let(:min_length) { 2 }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with too long a value when having a max_length' do- let(:value) { 'a' * 6 }+ context "with too long a value when having a max_length" do+ let(:value) { "a" * 6 }let(:max_length) { 5 }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with a value of the correct length when having a max_length and a min_value' do- let(:value) { 'a' * 4 }+ context "with a value of the correct length when having a max_length and a min_value" do+ let(:value) { "a" * 4 }let(:min_length) { 4 }let(:max_length) { 4 }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).to be_validendend- context 'with an empty value when having a regexp' do- let(:value) { '' }- let(:regexp) { '^[A-Z0-9]*$' }+ context "with an empty value when having a regexp" do+ let(:value) { "" }+ let(:regexp) { "^[A-Z0-9]*$" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a not matching value when having a regexp' do- let(:value) { 'a' }- let(:regexp) { '^[A-Z0-9]*$' }+ context "with a not matching value when having a regexp" do+ let(:value) { "a" }+ let(:regexp) { "^[A-Z0-9]*$" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with a matching value when having a regexp' do- let(:value) { 'A' }- let(:regexp) { '^[A-Z0-9]*$' }+ context "with a matching value when having a regexp" do+ let(:value) { "A" }+ let(:regexp) { "^[A-Z0-9]*$" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendendend- context 'for a list custom field' do- let(:custom_option1) { build_stubbed(:custom_option, value: 'value1') }- let(:custom_option2) { build_stubbed(:custom_option, value: 'value1') }+ context "for a list custom field" do+ let(:custom_option1) { build_stubbed(:custom_option, value: "value1") }+ let(:custom_option2) { build_stubbed(:custom_option, value: "value1") }let(:custom_field) do- build_stubbed(:custom_field, field_format: 'list', custom_options: [custom_option1, custom_option2])+ build_stubbed(:custom_field, field_format: "list", custom_options: [custom_option1, custom_option2])end- context 'with a value from the list' do+ context "with a value from the list" dolet(:value) { custom_option1.id }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with some string' do- let(:value) { 'abc' }+ context "with some string" do+ let(:value) { "abc" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with nil string' do+ context "with nil string" dolet(:value) { nil }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).to be_validendendend- context 'for an int custom field' do- let(:field_format) { 'int' }+ context "for an int custom field" do+ let(:field_format) { "int" }- context 'with a valid int string' do- let(:value) { '123' }+ context "with a valid int string" do+ let(:value) { "123" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a valid negative int string' do- let(:value) { '-123' }+ context "with a valid negative int string" do+ let(:value) { "-123" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a valid positive int string' do- let(:value) { '+123' }+ context "with a valid positive int string" do+ let(:value) { "+123" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with some non int string' do- let(:value) { 'abc' }+ context "with some non int string" do+ let(:value) { "abc" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with a float string' do- let(:value) { '5.5' }+ context "with a float string" do+ let(:value) { "5.5" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with an empty string' do- let(:value) { '' }+ context "with an empty string" do+ let(:value) { "" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendendend- context 'for a float custom field' do- let(:field_format) { 'float' }+ context "for a float custom field" do+ let(:field_format) { "float" }- context 'with a valid float string' do- let(:value) { '123.5' }+ context "with a valid float string" do+ let(:value) { "123.5" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a valid negative float string' do- let(:value) { '-123.5' }+ context "with a valid negative float string" do+ let(:value) { "-123.5" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a valid positive float string' do- let(:value) { '+123.5' }+ context "with a valid positive float string" do+ let(:value) { "+123.5" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with some non float string' do- let(:value) { 'abc' }+ context "with some non float string" do+ let(:value) { "abc" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validendend- context 'with an int string' do- let(:value) { '5' }+ context "with an int string" do+ let(:value) { "5" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with an empty string' do- let(:value) { '' }+ context "with an empty string" do+ let(:value) { "" }- it 'is valid' do+ it "is valid" doexpect(custom_value).to be_validendend- context 'with a mixed string' do- let(:value) { '6.5a' }+ context "with a mixed string" do+ let(:value) { "6.5a" }- it 'is invalid' do+ it "is invalid" doexpect(custom_value).not_to be_validend@@ -711,13 +711,13 @@ RSpec.describe CustomValue doendend- describe 'value/value=' do+ describe "value/value=" dolet(:custom_value) { build_stubbed(:custom_value) }let(:strategy_double) { instance_double(CustomValue::FormatStrategy) }- it 'calls the strategy for parsing and uses that value' do- original_value = 'original value'- parsed_value = 'parsed value'+ it "calls the strategy for parsing and uses that value" do+ original_value = "original value"+ parsed_value = "parsed value"allow(custom_value).to receive(:strategy)@@ -734,36 +734,36 @@ RSpec.describe CustomValue doendend- describe '#activate_custom_field_in_customized_project' do+ describe "#activate_custom_field_in_customized_project" dolet(:project) { create(:project) }- context 'with a given default value' do+ context "with a given default value" dolet(:custom_field) { create(:string_project_custom_field, default_value: "foo") }- context 'when a value other than the default value is set' do+ context "when a value other than the default value is set" dolet(:custom_value) { build(:custom_value, custom_field:, customized: project, value: "bar") }- it 'activates the custom field in the project after create if missing' do+ it "activates the custom field in the project after create if missing" doexpect(project.project_custom_fields).not_to include(custom_field)custom_value.save!expect(project.reload.project_custom_fields).to include(custom_field)endend- context 'when a value equal to the default value is set' do+ context "when a value equal to the default value is set" dolet(:custom_value) { build(:custom_value, custom_field:, customized: project, value: "foo") }- it 'activates the custom field in the project after create if missing' do+ it "activates the custom field in the project after create if missing" doexpect(project.project_custom_fields).not_to include(custom_field)custom_value.save!expect(project.reload.project_custom_fields).not_to include(custom_field)endend- context 'when a value is not set' do+ context "when a value is not set" dolet(:custom_value) { build(:custom_value, custom_field:, customized: project) }- it 'does not activate the custom field in the project after create if missing' do+ it "does not activate the custom field in the project after create if missing" doexpect(project.project_custom_fields).not_to include(custom_field)custom_value.save!expect(project.reload.project_custom_fields).not_to include(custom_field)@@ -771,23 +771,23 @@ RSpec.describe CustomValue doendend- context 'with no default value given' do+ context "with no default value given" dolet(:custom_field) { create(:string_project_custom_field) }- context 'when a value is set' do+ context "when a value is set" dolet(:custom_value) { build(:custom_value, custom_field:, customized: project, value: "bar") }- it 'activates the custom field in the project after create if missing' do+ it "activates the custom field in the project after create if missing" doexpect(project.project_custom_fields).not_to include(custom_field)custom_value.save!expect(project.reload.project_custom_fields).to include(custom_field)endend- context 'when a value is not set' do+ context "when a value is not set" dolet(:custom_value) { build(:custom_value, custom_field:, customized: project) }- it 'does not activate the custom field in the project after create if missing' do+ it "does not activate the custom field in the project after create if missing" doexpect(project.project_custom_fields).not_to include(custom_field)custom_value.save!expect(project.reload.project_custom_fields).not_to include(custom_field)diff --git a/spec/models/project_custom_field_project_mapping_spec.rb b/spec/models/project_custom_field_project_mapping_spec.rbindex f7baa6fc572..a404c842693 100644--- a/spec/models/project_custom_field_project_mapping_spec.rb+++ b/spec/models/project_custom_field_project_mapping_spec.rb@@ -26,14 +26,14 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe ProjectCustomFieldProjectMapping do- describe 'uniqueness by project' do+ describe "uniqueness by project" dolet!(:project) { create(:project) }let!(:project_custom_field) { create(:project_custom_field) }- it 'a project custom field can only be mapped to a project once' do+ it "a project custom field can only be mapped to a project once" doproject.project_custom_fields << project_custom_fieldexpect(described_class).to exist(custom_field_id: project_custom_field.id,diff --git a/spec/models/project_custom_field_spec.rb b/spec/models/project_custom_field_spec.rbindex 376bfd811ba..787f0238227 100644--- a/spec/models/project_custom_field_spec.rb+++ b/spec/models/project_custom_field_spec.rb@@ -26,15 +26,15 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe ProjectCustomField do- describe 'activation in projects' do- context 'when creating a new required project custom field' do+ describe "activation in projects" do+ context "when creating a new required project custom field" dolet!(:project) { create(:project) }let!(:another_project) { create(:project) }- it 'activates the required project custom fields in all projects' do+ it "activates the required project custom fields in all projects" doproject_custom_field = create(:project_custom_field, is_required: true)expect(ProjectCustomFieldProjectMapping).to exist(custom_field_id: project_custom_field.id,@@ -44,14 +44,14 @@ RSpec.describe ProjectCustomField doendend- context 'when setting an existing project custom field to required' do+ context "when setting an existing project custom field to required" dolet!(:project_custom_field) { create(:string_project_custom_field) } # optional nowlet!(:project) docreate(:project, custom_field_values: { "#{project_custom_field.id}": "foo" })endlet!(:another_project) { create(:project) } # not using the custom field- it 'activates the required project custom fields in all projects where it is not already activated' do+ it "activates the required project custom fields in all projects where it is not already activated" doexpect(ProjectCustomFieldProjectMapping).to exist(custom_field_id: project_custom_field.id,project_id: project.id)expect(ProjectCustomFieldProjectMapping).not_to exist(custom_field_id: project_custom_field.id,@@ -65,7 +65,7 @@ RSpec.describe ProjectCustomField doproject_id: another_project.id)end- it 'does not disabled project custom fields when set to optional' do+ it "does not disabled project custom fields when set to optional" doproject_custom_field.update!(is_required: true) # required nowproject_custom_field.update!(is_required: false) # optional again@@ -75,7 +75,7 @@ RSpec.describe ProjectCustomField doproject_id: another_project.id)end- it 'does not create duplicate mappings' do+ it "does not create duplicate mappings" doproject_custom_field.update!(is_required: true) # required now# mapping existed before, should not be duplicated@@ -84,13 +84,13 @@ RSpec.describe ProjectCustomField doendend- context 'when deleting a project custom field' do+ context "when deleting a project custom field" dolet!(:project_custom_field) { create(:string_project_custom_field) }let!(:project) docreate(:project, custom_field_values: { "#{project_custom_field.id}": "foo" })end- it 'deletes the project custom field mappings' do+ it "deletes the project custom field mappings" doexpect(ProjectCustomFieldProjectMapping).to exist(custom_field_id: project_custom_field.id,project_id: project.id)diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rbindex 121b8bdce4f..ab9055a9595 100644--- a/spec/models/user_spec.rb+++ b/spec/models/user_spec.rb@@ -143,14 +143,14 @@ RSpec.describe User doendend- context 'with other letter char classes' do+ context "with other letter char classes" dolet(:login) { "célîneüberölig" }- it 'is valid' do+ it "is valid" doexpect(user).to be_validend- it 'may be stored in the database' do+ it "may be stored in the database" doexpect(user.save).to be_truthyendenddiff --git a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rbindex c6314920eeb..cfff744ab78 100644--- a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb@@ -148,7 +148,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doenddef pdf_eq_ignore_spacing(strings)- expect(pdf.strings.join(' ')).to eq(strings.join(' '))+ expect(pdf.strings.join(" ")).to eq(strings.join(" "))enddescribe "with a request for a PDF table" dodiff --git a/spec/permissions/manage_project_custom_field_mappings_spec.rb b/spec/permissions/manage_project_custom_field_mappings_spec.rbindex 5920cf56291..04f5b4ecf73 100644--- a/spec/permissions/manage_project_custom_field_mappings_spec.rb+++ b/spec/permissions/manage_project_custom_field_mappings_spec.rb@@ -26,15 +26,15 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require File.expand_path('../support/permission_specs', __dir__)+require "spec_helper"+require File.expand_path("../support/permission_specs", __dir__)-RSpec.describe Projects::Settings::ProjectCustomFieldsController, 'manage_project_custom_field mappings permission',+RSpec.describe Projects::Settings::ProjectCustomFieldsController, "manage_project_custom_field mappings permission",type: :controller doinclude PermissionSpecs- check_permission_required_for('projects/settings/project_custom_fields#show', :select_project_custom_fields)- check_permission_required_for('projects/settings/project_custom_fields#toggle', :select_project_custom_fields)- check_permission_required_for('projects/settings/project_custom_fields#enable_all_of_section', :select_project_custom_fields)- check_permission_required_for('projects/settings/project_custom_fields#disable_all_of_section', :select_project_custom_fields)+ check_permission_required_for("projects/settings/project_custom_fields#show", :select_project_custom_fields)+ check_permission_required_for("projects/settings/project_custom_fields#toggle", :select_project_custom_fields)+ check_permission_required_for("projects/settings/project_custom_fields#enable_all_of_section", :select_project_custom_fields)+ check_permission_required_for("projects/settings/project_custom_fields#disable_all_of_section", :select_project_custom_fields)enddiff --git a/spec/permissions/manage_project_custom_values_spec.rb b/spec/permissions/manage_project_custom_values_spec.rbindex 4aa31a852cf..13d4c532e93 100644--- a/spec/permissions/manage_project_custom_values_spec.rb+++ b/spec/permissions/manage_project_custom_values_spec.rb@@ -26,25 +26,25 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require File.expand_path('../support/permission_specs', __dir__)+require "spec_helper"+require File.expand_path("../support/permission_specs", __dir__)-RSpec.describe Overviews::OverviewsController, 'manage_project_custom_values permission',+RSpec.describe Overviews::OverviewsController, "manage_project_custom_values permission",type: :controller doinclude PermissionSpecs# render sidebar on project overview page with view_project permission# TODO: prevents calling overviews/overviews#project_custom_fields_sidebar when not having the permission view_project (FAILED - 1)- it 'prevents calling overviews/overviews#project_custom_fields_sidebar when not having the permission view_project' do- pending 'spec failing, reason unknown'+ it "prevents calling overviews/overviews#project_custom_fields_sidebar when not having the permission view_project" do+ pending "spec failing, reason unknown"# wrapping the check_permission_required_for in a block to mark it as pending# spec should not be executed in this block, but standalone, will fail then with real error- check_permission_required_for('overviews/overviews#project_custom_fields_sidebar', :view_project)+ check_permission_required_for("overviews/overviews#project_custom_fields_sidebar", :view_project)end# render dialog with inputs for editing project attributes with edit_project permission- check_permission_required_for('overviews/overviews#project_custom_field_section_dialog', :edit_project)+ check_permission_required_for("overviews/overviews#project_custom_field_section_dialog", :edit_project)# update project attributes with edit_project permission, deeper permission check via contract in place- check_permission_required_for('overviews/overviews#update_project_custom_values', :edit_project)+ check_permission_required_for("overviews/overviews#update_project_custom_values", :edit_project)enddiff --git a/spec/requests/api/v3/projects/create_resource_spec.rb b/spec/requests/api/v3/projects/create_resource_spec.rbindex 0ff82ecfcbd..02106e9baa6 100644--- a/spec/requests/api/v3/projects/create_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_resource_spec.rb@@ -26,10 +26,10 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require 'rack/test'+require "spec_helper"+require "rack/test"-RSpec.describe 'API v3 Project resource create', content_type: :json do+RSpec.describe "API v3 Project resource create", content_type: :json doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelper@@ -41,7 +41,7 @@ RSpec.describe 'API v3 Project resource create', content_type: :json doendlet(:custom_value) doCustomValue.create(custom_field:,- value: '1234',+ value: "1234",customized: project)endlet(:global_role) do@@ -51,8 +51,8 @@ RSpec.describe 'API v3 Project resource create', content_type: :json dolet(:path) { api_v3_paths.projects }let(:body) do{- identifier: 'new_project_identifier',- name: 'Project name'+ identifier: "new_project_identifier",+ name: "Project name"}.to_jsonend@@ -62,42 +62,42 @@ RSpec.describe 'API v3 Project resource create', content_type: :json dopost path, bodyend- it 'responds with 201 CREATED' do+ it "responds with 201 CREATED" doexpect(last_response.status).to eq(201)end- it 'creates a project' do+ it "creates a project" doexpect(Project.count).to be(1)end- it 'returns the created project' do+ it "returns the created project" doexpect(last_response.body)- .to be_json_eql('Project'.to_json)- .at_path('_type')+ .to be_json_eql("Project".to_json)+ .at_path("_type")expect(last_response.body)- .to be_json_eql('Project name'.to_json)- .at_path('name')+ .to be_json_eql("Project name".to_json)+ .at_path("name")end- context 'with a status' do+ context "with a status" dolet(:body) do{- identifier: 'new_project_identifier',- name: 'Project name',+ identifier: "new_project_identifier",+ name: "Project name",statusExplanation: { raw: "Some explanation." },_links: {status: {- href: api_v3_paths.project_status('off_track')+ href: api_v3_paths.project_status("off_track")}}}.to_jsonend- it 'sets the status' do+ it "sets the status" doexpect(last_response.body)- .to be_json_eql(api_v3_paths.project_status('off_track').to_json)- .at_path('_links/status/href')+ .to be_json_eql(api_v3_paths.project_status("off_track").to_json)+ .at_path("_links/status/href")expect(last_response.body).to be_json_eql(@@ -110,145 +110,145 @@ RSpec.describe 'API v3 Project resource create', content_type: :json do.at_path("statusExplanation")end- it 'creates a project' do+ it "creates a project" doexpect(Project.count).to be(1)endend- context 'with a visible custom field' do+ context "with a visible custom field" dolet(:body) do{- identifier: 'new_project_identifier',- name: 'Project name',+ identifier: "new_project_identifier",+ name: "Project name",custom_field.attribute_name(:camel_case) => {raw: "CF text"}}.to_jsonend- it 'sets the cf value' do+ it "sets the cf value" doexpect(last_response.body).to be_json_eql("CF text".to_json).at_path("customField#{custom_field.id}/raw")end- it 'automatically activates the cf for project if the value was provided' do+ it "automatically activates the cf for project if the value was provided" doexpect(Project.last.project_custom_fields).to contain_exactly(custom_field)endend- context 'with an invisible custom field' do+ context "with an invisible custom field" dolet(:body) do{- identifier: 'new_project_identifier',- name: 'Project name',+ identifier: "new_project_identifier",+ name: "Project name",invisible_custom_field.attribute_name(:camel_case) => {raw: "CF text"}}.to_jsonend- context 'with admin permissions' do+ context "with admin permissions" docurrent_user { create(:admin) }- it 'sets the cf value' do+ it "sets the cf value" doexpect(last_response.body).to be_json_eql("CF text".to_json).at_path("customField#{invisible_custom_field.id}/raw")end- it 'automatically activates the cf for project if the value was provided' do+ it "automatically activates the cf for project if the value was provided" doexpect(Project.last.project_custom_fields).to contain_exactly(invisible_custom_field)endend- context 'with non-admin permissions' do- it 'does not set the cf value' do+ context "with non-admin permissions" do+ it "does not set the cf value" doexpect(last_response.body).not_to have_json_path("customField#{invisible_custom_field.id}/raw")end- it 'does not activate the cf for project' do+ it "does not activate the cf for project" doexpect(Project.last.project_custom_fields).to be_emptyendendend- context 'without permission to create projects' do+ context "without permission to create projects" dolet(:permissions) { [] }- it 'responds with 403' do+ it "responds with 403" doexpect(last_response.status).to eq(403)end- it 'creates no project' do+ it "creates no project" doexpect(Project.count).to be(0)endend- context 'with missing name' do+ context "with missing name" dolet(:body) do{- identifier: 'some_identifier'+ identifier: "some_identifier"}.to_jsonend- it 'responds with 422' do+ it "responds with 422" doexpect(last_response.status).to eq(422)end- it 'creates no project' do+ it "creates no project" doexpect(Project.count).to be(0)end- it 'denotes the error' do+ it "denotes the error" doexpect(last_response.body)- .to be_json_eql('Error'.to_json)- .at_path('_type')+ .to be_json_eql("Error".to_json)+ .at_path("_type")expect(last_response.body).to be_json_eql("Name can't be blank.".to_json)- .at_path('message')+ .at_path("message")endend- context 'with a faulty status' do+ context "with a faulty status" dolet(:body) do{- identifier: 'new_project_identifier',- name: 'Project name',+ identifier: "new_project_identifier",+ name: "Project name",statusExplanation: "Some explanation.",_links: {status: {- href: api_v3_paths.project_status('faulty')+ href: api_v3_paths.project_status("faulty")}}}.to_jsonend- it 'responds with 422' do+ it "responds with 422" doexpect(last_response.status).to eq(422)end- it 'creates no project' do+ it "creates no project" doexpect(Project.count).to be(0)end- it 'denotes the error' do+ it "denotes the error" doexpect(last_response.body)- .to be_json_eql('Error'.to_json)- .at_path('_type')+ .to be_json_eql("Error".to_json)+ .at_path("_type")expect(last_response.body).to be_json_eql("Status is not set to one of the allowed values.".to_json)- .at_path('message')+ .at_path("message")endendenddiff --git a/spec/requests/api/v3/projects/show_resource_spec.rb b/spec/requests/api/v3/projects/show_resource_spec.rbindex 7fe2ac10cab..5c20d8f1984 100644--- a/spec/requests/api/v3/projects/show_resource_spec.rb+++ b/spec/requests/api/v3/projects/show_resource_spec.rb@@ -26,10 +26,10 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require 'rack/test'+require "spec_helper"+require "rack/test"-RSpec.describe 'API v3 Project resource show', content_type: :json do+RSpec.describe "API v3 Project resource show", content_type: :json doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelper@@ -50,7 +50,7 @@ RSpec.describe 'API v3 Project resource show', content_type: :json doendlet(:custom_value) doCustomValue.create(custom_field:,- value: '1234',+ value: "1234",customized: project)endlet(:invisible_custom_field) do@@ -58,7 +58,7 @@ RSpec.describe 'API v3 Project resource show', content_type: :json doendlet(:invisible_custom_value) doCustomValue.create(custom_field: invisible_custom_field,- value: '1234',+ value: "1234",customized: project)end@@ -84,27 +84,27 @@ RSpec.describe 'API v3 Project resource show', content_type: :json dolast_responseend- context 'for a logged in user' do- it 'responds with 200 OK' do+ context "for a logged in user" do+ it "responds with 200 OK" doexpect(subject.status).to eq(200)end- it 'responds with the correct project' do- expect(subject.body).to include_json('Project'.to_json).at_path('_type')- expect(subject.body).to be_json_eql(project.identifier.to_json).at_path('identifier')+ it "responds with the correct project" do+ expect(subject.body).to include_json("Project".to_json).at_path("_type")+ expect(subject.body).to be_json_eql(project.identifier.to_json).at_path("identifier")end- it 'links to the parent/ancestor project' do+ it "links to the parent/ancestor project" doexpect(subject.body).to be_json_eql(api_v3_paths.project(parent_project.id).to_json)- .at_path('_links/parent/href')+ .at_path("_links/parent/href")expect(subject.body).to be_json_eql(api_v3_paths.project(parent_project.id).to_json)- .at_path('_links/ancestors/0/href')+ .at_path("_links/ancestors/0/href")end- it 'includes only visible custom fields' do+ it "includes only visible custom fields" docustom_valueinvisible_custom_value@@ -116,10 +116,10 @@ RSpec.describe 'API v3 Project resource show', content_type: :json do.not_to have_json_path("customField#{invisible_custom_field.id}/raw")end- context 'with admin permissions' do+ context "with admin permissions" docurrent_user { admin }- it 'includes invisible custom fields' do+ it "includes invisible custom fields" docustom_valueinvisible_custom_value@@ -133,7 +133,7 @@ RSpec.describe 'API v3 Project resource show', content_type: :json doendend- it 'includes the project status' do+ it "includes the project status" doexpect(subject.body).to be_json_eql(project.status_explanation.to_json).at_path("statusExplanation/raw")@@ -143,69 +143,69 @@ RSpec.describe 'API v3 Project resource show', content_type: :json do.at_path("_links/status/href")end- context 'when requesting nonexistent project' do+ context "when requesting nonexistent project" dolet(:get_path) { api_v3_paths.project 9999 }before doresponseend- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'when requesting project without sufficient permissions' do+ context "when requesting project without sufficient permissions" dolet(:get_path) { api_v3_paths.project other_project.id }before doresponseend- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'when not being allowed to see the parent project' do+ context "when not being allowed to see the parent project" dolet!(:parent_memberships) do# no parent membershipsend- it 'shows the `undisclosed` uri' do+ it "shows the `undisclosed` uri" doexpect(subject.body).to be_json_eql(API::V3::URN_UNDISCLOSED.to_json)- .at_path('_links/parent/href')+ .at_path("_links/parent/href")endend- context 'with the project being archived/inactive' do+ context "with the project being archived/inactive" dolet(:project_active) { false }- context 'with the user being admin' do+ context "with the user being admin" docurrent_user { admin }- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(subject.status).to eq(200)end- it 'responds with the correct project' do- expect(subject.body).to include_json('Project'.to_json).at_path('_type')- expect(subject.body).to be_json_eql(project.identifier.to_json).at_path('identifier')+ it "responds with the correct project" do+ expect(subject.body).to include_json("Project".to_json).at_path("_type")+ expect(subject.body).to be_json_eql(project.identifier.to_json).at_path("identifier")endend- context 'with the user being no admin' do- it 'responds with 404' do+ context "with the user being no admin" do+ it "responds with 404" doexpect(subject.status).to eq(404)endendendend- context 'for a not logged in user' do+ context "for a not logged in user" docurrent_user { create(:anonymous) }before doget get_pathend- it_behaves_like 'not found response based on login_required'+ it_behaves_like "not found response based on login_required"endenddiff --git a/spec/requests/api/v3/projects/update_resource_spec.rb b/spec/requests/api/v3/projects/update_resource_spec.rbindex fe1a05c6b21..9a34d40a0cc 100644--- a/spec/requests/api/v3/projects/update_resource_spec.rb+++ b/spec/requests/api/v3/projects/update_resource_spec.rb@@ -26,10 +26,10 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require 'rack/test'+require "spec_helper"+require "rack/test"-RSpec.describe 'API v3 Project resource update', content_type: :json do+RSpec.describe "API v3 Project resource update", content_type: :json doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelper@@ -49,15 +49,15 @@ RSpec.describe 'API v3 Project resource update', content_type: :json doendlet(:custom_value) doCustomValue.create(custom_field:,- value: '1234',+ value: "1234",customized: project)endlet(:permissions) { [:edit_project] }let(:path) { api_v3_paths.project(project.id) }let(:body) do{- identifier: 'new_project_identifier',- name: 'Project name'+ identifier: "new_project_identifier",+ name: "Project name"}end@@ -69,11 +69,11 @@ RSpec.describe 'API v3 Project resource update', content_type: :json dopatch path, body.to_jsonend- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'alters the project' do+ it "alters the project" doproject.reloadexpect(project.name)@@ -83,16 +83,16 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do.to eql(body[:identifier])end- it 'returns the updated project' do+ it "returns the updated project" doexpect(last_response.body)- .to be_json_eql('Project'.to_json)- .at_path('_type')+ .to be_json_eql("Project".to_json)+ .at_path("_type")expect(last_response.body).to be_json_eql(body[:name].to_json)- .at_path('name')+ .at_path("name")end- context 'with a visible custom field' do+ context "with a visible custom field" dolet(:body) do{custom_field.attribute_name(:camel_case) => {@@ -101,22 +101,22 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'sets the cf value' do+ it "sets the cf value" doexpect(project.reload.send(custom_field.attribute_getter)).to eql("CF text")end- it 'automatically activates the cf for project if the value was provided' do+ it "automatically activates the cf for project if the value was provided" doexpect(project.project_custom_fields).to contain_exactly(custom_field)endend- context 'with an invisible custom field' do+ context "with an invisible custom field" dolet(:body) do{invisible_custom_field.attribute_name(:camel_case) => {@@ -125,58 +125,58 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- context 'with admin permissions' do+ context "with admin permissions" dolet(:current_user) { create(:admin) }- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'sets the cf value' do+ it "sets the cf value" doexpect(project.reload.send(invisible_custom_field.attribute_getter)).to eql("CF text")end- it 'automatically activates the cf for project if the value was provided' do+ it "automatically activates the cf for project if the value was provided" doexpect(project.reload.project_custom_fields).to contain_exactly(invisible_custom_field)endend- context 'with non-admin permissions' do- it 'responds with 200 OK' do+ context "with non-admin permissions" do+ it "responds with 200 OK" do# TBD: trying to set a not accessible custom field is silently ignoredexpect(last_response.status).to eq(200)end- it 'does not set the cf value' do+ it "does not set the cf value" doexpect(project.reload.custom_values).to be_emptyend- it 'does not activate the cf for project' do+ it "does not activate the cf for project" doexpect(project.reload.project_custom_fields).to be_emptyendendend- context 'without permission to patch projects' do+ context "without permission to patch projects" dolet(:permissions) { [] }- it 'responds with 403' do+ it "responds with 403" doexpect(last_response.status).to eq(403)end- it 'does not change the project' do+ it "does not change the project" doattributes_before = project.attributesexpect(project.reload.name)- .to eql(attributes_before['name'])+ .to eql(attributes_before["name"])endend- context 'with a nil status' do+ context "with a nil status" dolet(:body) do{statusExplanation: {@@ -190,14 +190,14 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- it 'alters the status' do+ it "alters the status" doexpect(last_response.body).to be_json_eql(nil.to_json)- .at_path('_links/status/href')+ .at_path("_links/status/href")project.reloadexpect(project.status_code).to be_nil- expect(project.status_explanation).to eq 'Some explanation.'+ expect(project.status_explanation).to eq "Some explanation."expect(last_response.body).to be_json_eql(@@ -211,7 +211,7 @@ RSpec.describe 'API v3 Project resource update', content_type: :json doendend- context 'with a status' do+ context "with a status" dolet(:body) do{statusExplanation: {@@ -219,16 +219,16 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do},_links: {status: {- href: api_v3_paths.project_status('off_track')+ href: api_v3_paths.project_status("off_track")}}}end- it 'alters the status' do+ it "alters the status" doexpect(last_response.body)- .to be_json_eql(api_v3_paths.project_status('off_track').to_json)- .at_path('_links/status/href')+ .to be_json_eql(api_v3_paths.project_status("off_track").to_json)+ .at_path("_links/status/href")expect(last_response.body).to be_json_eql(@@ -241,47 +241,47 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do.at_path("statusExplanation")end- it 'persists the altered status' do+ it "persists the altered status" doproject.reloadexpect(project.status_code)- .to eql('off_track')+ .to eql("off_track")expect(project.status_explanation)- .to eql('Some explanation.')+ .to eql("Some explanation.")endend- context 'with faulty name' do+ context "with faulty name" dolet(:body) do{name: nil}end- it 'responds with 422' do+ it "responds with 422" doexpect(last_response.status).to eq(422)end- it 'does not change the project' do+ it "does not change the project" doattributes_before = project.attributesexpect(project.reload.name)- .to eql(attributes_before['name'])+ .to eql(attributes_before["name"])end- it 'denotes the error' do+ it "denotes the error" doexpect(last_response.body)- .to be_json_eql('Error'.to_json)- .at_path('_type')+ .to be_json_eql("Error".to_json)+ .at_path("_type")expect(last_response.body).to be_json_eql("Name can't be blank.".to_json)- .at_path('message')+ .at_path("message")endend- context 'with a faulty status' do+ context "with a faulty status" dolet(:body) do{_links: {@@ -292,36 +292,36 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- it 'responds with 422' do+ it "responds with 422" doexpect(last_response.status).to eq(422)end- it 'does not change the project status' do+ it "does not change the project status" docode_before = project.status_codeexpect(project.reload.status_code).to eql(code_before)end- it 'denotes the error' do+ it "denotes the error" doexpect(last_response.body)- .to be_json_eql('Error'.to_json)- .at_path('_type')+ .to be_json_eql("Error".to_json)+ .at_path("_type")expect(last_response.body).to be_json_eql("Status is not set to one of the allowed values.".to_json)- .at_path('message')+ .at_path("message")endend- context 'when archiving the project (change active from true to false)' do+ context "when archiving the project (change active from true to false)" dolet(:body) do{active: false}end- context 'for an admin' do+ context "for an admin" dolet(:current_user) docreate(:admin)end@@ -334,51 +334,51 @@ RSpec.describe 'API v3 Project resource update', content_type: :json docreate(:project)end- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'archives the project' do+ it "archives the project" doexpect(project.reload.active).to be_falseyend- it 'archives the child project' do+ it "archives the child project" doexpect(child_project.reload.active).to be_falseyendend- context 'for a user with only edit_project permission' do+ context "for a user with only edit_project permission" dolet(:permissions) { [:edit_project] }- it 'responds with 403' do+ it "responds with 403" doexpect(last_response.status).to eq(403)end- it 'does not alter the project' do+ it "does not alter the project" doexpect(project.reload.active).to be_truthyendend- context 'for a user with only archive_project permission' do+ context "for a user with only archive_project permission" dolet(:permissions) { [:archive_project] }- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'archives the project' do+ it "archives the project" doexpect(project.reload.active).to be_falseyendend- context 'for a user missing archive_project permission on child project' do+ context "for a user missing archive_project permission on child project" dolet(:permissions) { [:archive_project] }let(:project) docreate(:project).tap do |p|@@ -387,19 +387,19 @@ RSpec.describe 'API v3 Project resource update', content_type: :json doendlet(:child_project) { create(:project) }- it 'responds with 422 (and not 403?)' do+ it "responds with 422 (and not 403?)" doexpect(last_response.status).to eq(422)end- it 'does not alter the project' do+ it "does not alter the project" doexpect(project.reload.active).to be_truthyendendend- context 'when setting a custom field and archiving the project' do+ context "when setting a custom field and archiving the project" dolet(:body) do{active: false,@@ -409,7 +409,7 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- context 'for an admin' do+ context "for an admin" dolet(:current_user) docreate(:admin)end@@ -422,56 +422,56 @@ RSpec.describe 'API v3 Project resource update', content_type: :json docreate(:project)end- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'sets the cf value' do+ it "sets the cf value" doexpect(project.reload.send(custom_field.attribute_getter)).to eql("CF text")end- it 'archives the project' do+ it "archives the project" doexpect(project.reload.active).to be_falseyend- it 'archives the child project' do+ it "archives the child project" doexpect(child_project.reload.active).to be_falseyendend- context 'for a user with only edit_project permission' do+ context "for a user with only edit_project permission" dolet(:permissions) { [:edit_project] }- it 'responds with 403' do+ it "responds with 403" doexpect(last_response.status).to eq(403)endend- context 'for a user with only archive_project permission' do+ context "for a user with only archive_project permission" dolet(:permissions) { [:archive_project] }- it 'responds with 403' do+ it "responds with 403" doexpect(last_response.status).to eq(403)endend- context 'for a user with both archive_project and edit_project permissions' do+ context "for a user with both archive_project and edit_project permissions" dolet(:permissions) { %i[archive_project edit_project] }- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)endendend- context 'when unarchiving the project (change active from false to true)' do+ context "when unarchiving the project (change active from false to true)" dolet(:project_active) { false }let(:body) do{@@ -479,7 +479,7 @@ RSpec.describe 'API v3 Project resource update', content_type: :json do}end- context 'for an admin' do+ context "for an admin" dolet(:current_user) docreate(:admin)end@@ -492,31 +492,31 @@ RSpec.describe 'API v3 Project resource update', content_type: :json docreate(:project)end- it 'responds with 200 OK' do+ it "responds with 200 OK" doexpect(last_response.status).to eq(200)end- it 'unarchives the project' do+ it "unarchives the project" doexpect(project.reload).to be_activeend- it 'unarchives the child project' do+ it "unarchives the child project" doexpect(child_project.reload).to be_activeendend- context 'for a non-admin user, even with both archive_project and edit_project permissions' do+ context "for a non-admin user, even with both archive_project and edit_project permissions" dolet(:permissions) { %i[archive_project edit_project] }- it 'responds with 404' do+ it "responds with 404" doexpect(last_response.status).to eq(404)end- it 'does not alter the project' do+ it "does not alter the project" doexpect(project.reload).not_to be_activeenddiff --git a/spec/requests/auth/ldap_sso_spec.rb b/spec/requests/auth/ldap_sso_spec.rbindex d1367a9fc0c..ce3cc736283 100644--- a/spec/requests/auth/ldap_sso_spec.rb+++ b/spec/requests/auth/ldap_sso_spec.rb@@ -58,20 +58,20 @@ RSpec.describe "LDAP authentication",expect(subject).to redirect_to "/?first_time_user=true"end- context 'with a user that has umlauts in their name' do- let(:username) { 'bölle' }- let(:password) { 'bólle' }+ context "with a user that has umlauts in their name" do+ let(:username) { "bölle" }+ let(:password) { "bólle" }- it 'creates a user with umlauts on the fly' do- expect(User.find_by(login: 'bölle')).to be_nil+ it "creates a user with umlauts on the fly" do+ expect(User.find_by(login: "bölle")).to be_nilexpect { subject }.to change(User.not_builtin.active, :count).by(1)- user = User.find_by(login: 'bölle')+ user = User.find_by(login: "bölle")expect(user).to be_presentexpect(user).to be_activeexpect(session[:user_id]).to eq user.id- expect(subject).to redirect_to '/?first_time_user=true'+ expect(subject).to redirect_to "/?first_time_user=true"endenddiff --git a/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb b/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rbindex 799403ac449..9c7d6f934f3 100644--- a/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb@@ -26,22 +26,22 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService dolet!(:project) { create(:project) }- let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: 'Section with invisible fields') }+ let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: "Section with invisible fields") }let!(:visible_project_custom_field) docreate(:project_custom_field,- name: 'Visible field',+ name: "Visible field",visible: true,project_custom_field_section: section_with_invisible_fields)endlet!(:visible_required_project_custom_field) docreate(:project_custom_field,- name: 'Visible required field',+ name: "Visible required field",visible: true,is_required: true,project_custom_field_section: section_with_invisible_fields)@@ -49,17 +49,17 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService dolet!(:invisible_project_custom_field) docreate(:project_custom_field,- name: 'Admin only field',+ name: "Admin only field",visible: false,project_custom_field_section: section_with_invisible_fields)endlet(:instance) { described_class.new(user:, project:, project_custom_field_section: section_with_invisible_fields) }- context 'with admin permissions' do+ context "with admin permissions" dolet(:user) { create(:admin) }- it 'bulk enables/disables all (non-required) fields of the section, including invisible ones' do+ it "bulk enables/disables all (non-required) fields of the section, including invisible ones" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -79,11 +79,11 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService doendend- context 'with non-admin but sufficient permissions' do+ context "with non-admin but sufficient permissions" dolet(:user) docreate(:user,- firstname: 'Project',- lastname: 'Admin',+ firstname: "Project",+ lastname: "Admin",member_with_permissions: {project => %w[view_work_packages@@ -93,7 +93,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService do})end- it 'bulk enables/disables all fields of the section, excluding invisible ones' do+ it "bulk enables/disables all fields of the section, excluding invisible ones" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -115,11 +115,11 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService doendend- context 'with insufficient permissions' do+ context "with insufficient permissions" dolet(:user) docreate(:user,- firstname: 'Project',- lastname: 'Editor',+ firstname: "Project",+ lastname: "Editor",member_with_permissions: {project => %w[view_work_packages@@ -128,7 +128,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService do})end- it 'cannot bulk enable/disable project custom fields' do+ it "cannot bulk enable/disable project custom fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)diff --git a/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb b/spec/services/project_custom_field_project_mappings/toggle_service_spec.rbindex 929514c7003..b480dcb7db5 100644--- a/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb@@ -26,22 +26,22 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe ProjectCustomFieldProjectMappings::ToggleService dolet!(:project) { create(:project) }- let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: 'Section with invisible fields') }+ let!(:section_with_invisible_fields) { create(:project_custom_field_section, name: "Section with invisible fields") }let!(:visible_project_custom_field) docreate(:project_custom_field,- name: 'Visible field',+ name: "Visible field",visible: true,project_custom_field_section: section_with_invisible_fields)endlet!(:visible_required_project_custom_field) docreate(:project_custom_field,- name: 'Visible required field',+ name: "Visible required field",visible: true,is_required: true,project_custom_field_section: section_with_invisible_fields)@@ -49,17 +49,17 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService dolet!(:invisible_project_custom_field) docreate(:project_custom_field,- name: 'Admin only field',+ name: "Admin only field",visible: false,project_custom_field_section: section_with_invisible_fields)endlet(:instance) { described_class.new(user:) }- context 'with admin permissions' do+ context "with admin permissions" dolet(:user) { create(:admin) }- it 'toggles visible, non-required fields' do+ it "toggles visible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -77,7 +77,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'toggles invisible, non-required fields' do+ it "toggles invisible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -95,7 +95,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'does not toggle required fields' do+ it "does not toggle required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -108,11 +108,11 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService doendend- context 'with non-admin but sufficient permissions' do+ context "with non-admin but sufficient permissions" dolet(:user) docreate(:user,- firstname: 'Project',- lastname: 'Admin',+ firstname: "Project",+ lastname: "Admin",member_with_permissions: {project => %w[view_work_packages@@ -122,7 +122,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do})end- it 'toggles visible, non-required fields' do+ it "toggles visible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -140,7 +140,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'does not toggle invisible, non-required fields' do+ it "does not toggle invisible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -152,7 +152,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'does not toggle required fields' do+ it "does not toggle required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -165,11 +165,11 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService doendend- context 'with insufficient permissions' do+ context "with insufficient permissions" dolet(:user) docreate(:user,- firstname: 'Project',- lastname: 'Editor',+ firstname: "Project",+ lastname: "Editor",member_with_permissions: {project => %w[view_work_packages@@ -178,7 +178,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do})end- it 'does not toggle visible, non-required fields' do+ it "does not toggle visible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -190,7 +190,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'does not toggle invisible, non-required fields' do+ it "does not toggle invisible, non-required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)@@ -202,7 +202,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService do)end- it 'does not toggle required fields' do+ it "does not toggle required fields" doexpect(project.project_custom_fields).to contain_exactly(visible_required_project_custom_field)diff --git a/spec/support/form_fields/primerized/autocomplete_field.rb b/spec/support/form_fields/primerized/autocomplete_field.rbindex 8e4b0bf37e0..536a3a24dc3 100644--- a/spec/support/form_fields/primerized/autocomplete_field.rb+++ b/spec/support/form_fields/primerized/autocomplete_field.rb@@ -1,4 +1,4 @@-require_relative 'form_field'+require_relative "form_field"module FormFieldsmodule Primerized@@ -7,69 +7,69 @@ module FormFieldsdef select_option(*values)values.each do |val|- field_container.find('.ng-select-container').click- expect(page).to have_css('.ng-option', text: val, visible: :all)- page.find('.ng-option', text: val, visible: :all).click+ field_container.find(".ng-select-container").click+ expect(page).to have_css(".ng-option", text: val, visible: :all)+ page.find(".ng-option", text: val, visible: :all).clicksleep 0.25 # still required?endenddef deselect_option(*values)values.each do |val|- field_container.find('.ng-select-container').click- page.find('.ng-value', text: val, visible: :all).find('.ng-value-icon').click+ field_container.find(".ng-select-container").click+ page.find(".ng-value", text: val, visible: :all).find(".ng-value-icon").clicksleep 0.25 # still required?end- field_container.find('.ng-arrow-wrapper').click # close dropdown+ field_container.find(".ng-arrow-wrapper").click # close dropdownsleep 0.25enddef search(text)- field_container.find('.ng-select-container input').set text+ field_container.find(".ng-select-container input").set textenddef open_options- field_container.find('.ng-select-container').click+ field_container.find(".ng-select-container").clickenddef clear- field_container.find('.ng-clear-wrapper', visible: :all).click+ field_container.find(".ng-clear-wrapper", visible: :all).clickend### expectationsdef expect_selected(*values)values.each do |val|- expect(field_container).to have_css('.ng-value', text: val)+ expect(field_container).to have_css(".ng-value", text: val)endenddef expect_not_selected(*values)values.each do |val|- expect(field_container).to have_no_css('.ng-value', text: val, wait: 1)+ expect(field_container).to have_no_css(".ng-value", text: val, wait: 1)endenddef expect_blank- expect(field_container).to have_css('.ng-value', count: 0)+ expect(field_container).to have_css(".ng-value", count: 0)enddef expect_no_option(option)expect(page)- .to have_no_css('.ng-option', text: option, visible: :all, wait: 1)+ .to have_no_css(".ng-option", text: option, visible: :all, wait: 1)enddef expect_option(option)expect(page)- .to have_css('.ng-option', text: option, visible: :visible)+ .to have_css(".ng-option", text: option, visible: :visible)enddef expect_visible- expect(field_container).to have_css('ng-select')+ expect(field_container).to have_css("ng-select")enddef expect_error(string = nil)- expect(field_container).to have_css('.FormControl-inlineValidation')+ expect(field_container).to have_css(".FormControl-inlineValidation")expect(field_container).to have_content(string) if stringendenddiff --git a/spec/support/form_fields/primerized/editor_form_field.rb b/spec/support/form_fields/primerized/editor_form_field.rbindex 6f6b5970564..b8e6c8b362e 100644--- a/spec/support/form_fields/primerized/editor_form_field.rb+++ b/spec/support/form_fields/primerized/editor_form_field.rb@@ -1,4 +1,4 @@-require_relative 'form_field'+require_relative "form_field"module FormFieldsmodule Primerized@@ -37,7 +37,7 @@ module FormFieldsdef expect_error(string = nil)sleep 2 # quick fix for stale element error- expect(field_container).to have_css('.FormControl-inlineValidation')+ expect(field_container).to have_css(".FormControl-inlineValidation")expect(field_container).to have_content(string) if stringendenddiff --git a/spec/support/form_fields/primerized/input_field.rb b/spec/support/form_fields/primerized/input_field.rbindex 6b7d87db7da..5917f9684f1 100644--- a/spec/support/form_fields/primerized/input_field.rb+++ b/spec/support/form_fields/primerized/input_field.rb@@ -1,4 +1,4 @@-require_relative 'form_field'+require_relative "form_field"module FormFieldsmodule Primerized@@ -26,7 +26,7 @@ module FormFieldsdef expect_value(value)scroll_to_element(field_container)- expect(field_container).to have_css('input') { |el| el.value == value }+ expect(field_container).to have_css("input") { |el| el.value == value }endendend