Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Style/ItBlockParameter: Use `it` block parameter.RuboCopStyle/ItBlockParameter (#19318)

Kabiru Mwenjab52debb70d92
diff --git a/app/components/shares/manage_shares_component.rb b/app/components/shares/manage_shares_component.rb
index fa61c6afdd5..f4cf92d172c 100644
--- a/app/components/shares/manage_shares_component.rb
+++ b/app/components/shares/manage_shares_component.rb
@@ -27,7 +27,7 @@
#++
module Shares
- class ManageSharesComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class ManageSharesComponent < ApplicationComponent
include ApplicationHelper
include MemberHelper
include OpPrimer::ComponentHelpers
@@ -106,7 +106,7 @@ module Shares
return false if role_filter_value.nil?
- selected_role = strategy.available_roles.find { _1[:value] == option[:value] }
+ selected_role = strategy.available_roles.find { it[:value] == option[:value] }
selected_role[:value] == role_filter_value.to_i
end
diff --git a/app/components/users/profile/attributes_component.rb b/app/components/users/profile/attributes_component.rb
index a0bbde12307..0283e9454af 100644
--- a/app/components/users/profile/attributes_component.rb
+++ b/app/components/users/profile/attributes_component.rb
@@ -28,7 +28,7 @@
module Users
module Profile
- class AttributesComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class AttributesComponent < ApplicationComponent
include ApplicationHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
@@ -40,7 +40,7 @@ module Users
end
def render?
- user_is_allowed_to_see_email || @user.visible_custom_field_values.any? { _1.value.present? }
+ user_is_allowed_to_see_email || @user.visible_custom_field_values.any? { it.value.present? }
end
def visible_custom_fields
diff --git a/app/contracts/shares/base_contract.rb b/app/contracts/shares/base_contract.rb
index 5bd00481f50..6e5742d807c 100644
--- a/app/contracts/shares/base_contract.rb
+++ b/app/contracts/shares/base_contract.rb
@@ -54,7 +54,7 @@ module Shares
end
def role_grantable
- errors.add(:roles, :ungrantable) unless active_roles.all? { _1.is_a?(assignable_role_class) }
+ errors.add(:roles, :ungrantable) unless active_roles.all? { it.is_a?(assignable_role_class) }
end
def active_roles
diff --git a/app/controllers/work_packages/moves_controller.rb b/app/controllers/work_packages/moves_controller.rb
index ef2141b28a5..862e596aa3f 100644
--- a/app/controllers/work_packages/moves_controller.rb
+++ b/app/controllers/work_packages/moves_controller.rb
@@ -126,7 +126,7 @@ class WorkPackages::MovesController < ApplicationController
hierarchies = WorkPackageHierarchy
.includes(:ancestor)
.where(ancestor_id: @work_packages.select(:id))
- Type.where(id: hierarchies.map { _1.ancestor.type_id })
+ Type.where(id: hierarchies.map { it.ancestor.type_id })
.select("distinct id")
.pluck(:id)
.difference(@types.pluck(:id))
diff --git a/app/controllers/work_packages/progress_controller.rb b/app/controllers/work_packages/progress_controller.rb
index 7a4b702b254..676fd79e928 100644
--- a/app/controllers/work_packages/progress_controller.rb
+++ b/app/controllers/work_packages/progress_controller.rb
@@ -142,7 +142,7 @@ class WorkPackages::ProgressController < ApplicationController
"remaining_hours_touched",
"done_ratio_touched",
"status_id_touched")
- .transform_values { _1 == "true" }
+ .transform_values { it == "true" }
.permit!
end
@@ -153,7 +153,7 @@ class WorkPackages::ProgressController < ApplicationController
end
def allowed_touched_params
- allowed_params.filter { touched?(_1) }
+ allowed_params.filter { touched?(it) }
end
def allowed_params
diff --git a/app/forms/work_packages/progress_form.rb b/app/forms/work_packages/progress_form.rb
index 3a7ab982802..f90b5064afb 100644
--- a/app/forms/work_packages/progress_form.rb
+++ b/app/forms/work_packages/progress_form.rb
@@ -173,7 +173,7 @@ class WorkPackages::ProgressForm < ApplicationForm
def field_value(name)
errors = @work_package.errors.where(name)
- if (user_value = errors.map { |error| error.options[:value] }.find { !_1.nil? })
+ if (user_value = errors.map { |error| error.options[:value] }.find { !it.nil? })
user_value
elsif name == :done_ratio
as_percent(@work_package.public_send(name))
diff --git a/app/models/members/roles_diff.rb b/app/models/members/roles_diff.rb
index 9fe82cb083f..34d23a11017 100644
--- a/app/models/members/roles_diff.rb
+++ b/app/models/members/roles_diff.rb
@@ -63,7 +63,7 @@ class Members::RolesDiff
def user_previous_member_roles_ids
Set.new(user_member.member_roles
- .reject { group_member.member_roles.map(&:id).include?(_1.inherited_from) }
+ .reject { group_member.member_roles.map(&:id).include?(it.inherited_from) }
.map(&:role_id).uniq)
end
diff --git a/app/models/principal.rb b/app/models/principal.rb
index c031896c8cb..2e18fb8d740 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -128,7 +128,7 @@ class Principal < ApplicationRecord
def self.columns_for_name(formatter = nil)
raise NotImplementedError, "Redefine in subclass" unless self == Principal
- [User, Group, PlaceholderUser].map { _1.columns_for_name(formatter) }.inject(:|)
+ [User, Group, PlaceholderUser].map { it.columns_for_name(formatter) }.inject(:|)
end
# Select columns for formatting the user's name.
diff --git a/app/models/queries/projects/selects/default.rb b/app/models/queries/projects/selects/default.rb
index 609698118c8..8101f17df78 100644
--- a/app/models/queries/projects/selects/default.rb
+++ b/app/models/queries/projects/selects/default.rb
@@ -34,6 +34,6 @@ class Queries::Projects::Selects::Default < Queries::Selects::Base
end
def self.all_available
- KEYS.map { new(_1) }
+ KEYS.map { new(it) }
end
end
diff --git a/app/models/types/patterns/collection.rb b/app/models/types/patterns/collection.rb
index cc94bad0907..c779f1278fa 100644
--- a/app/models/types/patterns/collection.rb
+++ b/app/models/types/patterns/collection.rb
@@ -45,7 +45,7 @@ module Types
end
def initialize(patterns:)
- transformed = patterns.transform_values { Pattern.new(**_1) }.freeze
+ transformed = patterns.transform_values { Pattern.new(**it) }.freeze
super(patterns: transformed)
end
diff --git a/app/seeders/composite_seeder.rb b/app/seeders/composite_seeder.rb
index 4bdfbde74cb..504c530f5e2 100644
--- a/app/seeders/composite_seeder.rb
+++ b/app/seeders/composite_seeder.rb
@@ -30,7 +30,7 @@ class CompositeSeeder < Seeder
seed_with(data_seeders)
if discovered_seeders.any?
- print_status "Loading discovered seeders: #{discovered_seeders.map { seeder_name(_1) }.join(', ')}"
+ print_status "Loading discovered seeders: #{discovered_seeders.map { seeder_name(it) }.join(', ')}"
seed_with(discovered_seeders)
end
end
diff --git a/app/seeders/source/translate.rb b/app/seeders/source/translate.rb
index 7f29cf923a6..e1638c3e9d2 100644
--- a/app/seeders/source/translate.rb
+++ b/app/seeders/source/translate.rb
@@ -65,8 +65,8 @@ module Source::Translate
def translatable_keys(hash)
hash.keys
- .filter { translatable?(_1) }
- .map { remove_translatable_prefix(_1) }
+ .filter { translatable?(it) }
+ .map { remove_translatable_prefix(it) }
end
def translate_value(value, i18n_key)
diff --git a/app/services/journals/create_service/association.rb b/app/services/journals/create_service/association.rb
index 7242109d183..ad785dab0f4 100644
--- a/app/services/journals/create_service/association.rb
+++ b/app/services/journals/create_service/association.rb
@@ -42,7 +42,7 @@ class Journals::CreateService
def self.for(journable)
ASSOCIATION_NAMES
- .map { "Journals::CreateService::#{_1}".constantize.new(journable) }
+ .map { "Journals::CreateService::#{it}".constantize.new(journable) }
.select(&:associated?)
end
diff --git a/app/services/shares/concerns/role_assignment.rb b/app/services/shares/concerns/role_assignment.rb
index 30a140fb3ae..1b4a2a73a4e 100644
--- a/app/services/shares/concerns/role_assignment.rb
+++ b/app/services/shares/concerns/role_assignment.rb
@@ -38,7 +38,7 @@ module Shares::Concerns::RoleAssignment
# into account are those that have not been inherited.
def existing_ids
model.member_roles
- .select { _1.inherited_from.nil? }
+ .select { it.inherited_from.nil? }
.map(&:role_id)
end
end
diff --git a/app/services/work_packages/update_ancestors_service.rb b/app/services/work_packages/update_ancestors_service.rb
index 1e49a1200e7..5c1769d8a85 100644
--- a/app/services/work_packages/update_ancestors_service.rb
+++ b/app/services/work_packages/update_ancestors_service.rb
@@ -58,7 +58,7 @@ class WorkPackages::UpdateAncestorsService < BaseServices::BaseCallable
end
def ancestors(work_packages)
- work_packages.reject { initiator?(_1) }
+ work_packages.reject { initiator?(it) }
end
def update_current_and_former_ancestors(attributes)
@@ -73,7 +73,7 @@ class WorkPackages::UpdateAncestorsService < BaseServices::BaseCallable
end
def save_updated_work_packages(updated_work_packages)
- updated_initiators, updated_ancestors = updated_work_packages.partition { initiator?(_1) }
+ updated_initiators, updated_ancestors = updated_work_packages.partition { initiator?(it) }
# Send notifications for initiator updates
success = updated_initiators.all? { |wp| wp.save(validate: false) }
diff --git a/lib/api/v3/queries/schemas/query_filter_instance_schema_collection_representer.rb b/lib/api/v3/queries/schemas/query_filter_instance_schema_collection_representer.rb
index 51e0ba8799b..68f2d40d732 100644
--- a/lib/api/v3/queries/schemas/query_filter_instance_schema_collection_representer.rb
+++ b/lib/api/v3/queries/schemas/query_filter_instance_schema_collection_representer.rb
@@ -32,7 +32,7 @@ module API
module Schemas
class QueryFilterInstanceSchemaCollectionRepresenter < ::API::V3::Schemas::SchemaCollectionRepresenter
def initialize(filters, ...)
- filters = filters.reject { ::Queries::Register.excluded_filters.include?(_1.class) }
+ filters = filters.reject { ::Queries::Register.excluded_filters.include?(it.class) }
super
end
diff --git a/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb b/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb
index ff0798a64a7..9c3ac74a793 100644
--- a/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb
+++ b/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb
@@ -131,7 +131,7 @@ module API
end
def property_supported?(property)
- ALL_SUPPORTED_PROPERTIES.any? { _1.is_a?(Regexp) ? property =~ _1 : property == _1 }
+ ALL_SUPPORTED_PROPERTIES.any? { it.is_a?(Regexp) ? property =~ it : property == it }
end
end
end
diff --git a/lib/open_project/access_control.rb b/lib/open_project/access_control.rb
index 0da32c86563..57b9257d5b3 100644
--- a/lib/open_project/access_control.rb
+++ b/lib/open_project/access_control.rb
@@ -95,7 +95,7 @@ module OpenProject
@mapped_permissions.select { |p| p.name == action }
end
- permissions.any? && permissions.all? { !_1.enabled? }
+ permissions.any? && permissions.all? { !it.enabled? }
end
def public_permissions
diff --git a/lib_static/plugins/load_path_helper.rb b/lib_static/plugins/load_path_helper.rb
index 172388f9163..167ee83a027 100644
--- a/lib_static/plugins/load_path_helper.rb
+++ b/lib_static/plugins/load_path_helper.rb
@@ -35,7 +35,7 @@ module Plugins
# fetch load paths for available plugins
def self.plugin_load_paths
- Rails.application.config.plugins_to_test_paths.map { _1.relative_path_from(Rails.root).to_s }
+ Rails.application.config.plugins_to_test_paths.map { it.relative_path_from(Rails.root).to_s }
end
end
end
diff --git a/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb b/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
index cb1888c3cb7..b8a64d4ec10 100644
--- a/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
+++ b/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
@@ -55,7 +55,7 @@ module BasicData
end
def backlogs_configured?
- BACKLOGS_SETTINGS_KEYS.all? { configured?(_1) }
+ BACKLOGS_SETTINGS_KEYS.all? { configured?(it) }
end
def configured?(key)
diff --git a/modules/bim/lib/open_project/bim/bcf_json/faster_converter.rb b/modules/bim/lib/open_project/bim/bcf_json/faster_converter.rb
index a0a1ffecaf9..3291ee8c52e 100644
--- a/modules/bim/lib/open_project/bim/bcf_json/faster_converter.rb
+++ b/modules/bim/lib/open_project/bim/bcf_json/faster_converter.rb
@@ -62,7 +62,7 @@ module OpenProject::Bim::BcfJson
elsif array_of_hashes?(array)
if array_of_similar_hashes?(array)
# array of values like [{x: 1, y: 2}, {x: -3, y: 12}, ...]
- array.map! { make_ox_hash_look_like_loaded_by_rexml(_1) }
+ array.map! { make_ox_hash_look_like_loaded_by_rexml(it) }
else
hash = merge_hashes_together(array)
make_ox_hash_look_like_loaded_by_rexml(hash)
@@ -79,7 +79,7 @@ module OpenProject::Bim::BcfJson
end
def array_of_hashes?(array)
- array.all? { _1.is_a?(Hash) }
+ array.all? { it.is_a?(Hash) }
end
def array_of_similar_hashes?(array)
diff --git a/modules/boards/spec/services/basic_board_create_service_spec.rb b/modules/boards/spec/services/basic_board_create_service_spec.rb
index 9bfa503afdd..f61d6adadd7 100644
--- a/modules/boards/spec/services/basic_board_create_service_spec.rb
+++ b/modules/boards/spec/services/basic_board_create_service_spec.rb
@@ -75,7 +75,7 @@ RSpec.describe Boards::BasicBoardCreateService do
subject
query_filter = queries.flat_map(&:filters).map(&:to_hash).first
- widget_filter = widgets.flat_map { _1.options["filters"] }.first
+ widget_filter = widgets.flat_map { it.options["filters"] }.first
expect(query_filter).to have_key :manual_sort
expect(query_filter).to eq widget_filter
diff --git a/modules/boards/spec/services/status_board_create_service_spec.rb b/modules/boards/spec/services/status_board_create_service_spec.rb
index 1c204425470..3a0f36b6137 100644
--- a/modules/boards/spec/services/status_board_create_service_spec.rb
+++ b/modules/boards/spec/services/status_board_create_service_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe Boards::StatusBoardCreateService do
subject
query_filter = queries.flat_map(&:filters).map(&:to_hash).first
- widget_filter = widgets.flat_map { _1.options["filters"] }.first
+ widget_filter = widgets.flat_map { it.options["filters"] }.first
expect(query_filter).to match_array(widget_filter)
end
diff --git a/modules/boards/spec/services/version_board_create_service_spec.rb b/modules/boards/spec/services/version_board_create_service_spec.rb
index 47ebf4712fe..e55fae72306 100644
--- a/modules/boards/spec/services/version_board_create_service_spec.rb
+++ b/modules/boards/spec/services/version_board_create_service_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe Boards::VersionBoardCreateService do
context "when there are no versions that apply for the project" do
before do
- versions.each { _1.update!(status: "closed") }
+ versions.each { it.update!(status: "closed") }
end
it "sets the column_count to the default value" do
@@ -108,7 +108,7 @@ RSpec.describe Boards::VersionBoardCreateService do
subject
queries_filters = queries.flat_map(&:filters).map(&:to_hash)
- widgets_filters = widgets.flat_map { _1.options["filters"] }
+ widgets_filters = widgets.flat_map { it.options["filters"] }
expect(queries_filters).to match_array(widgets_filters)
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
index eacdb8ce5eb..d36bf190f9d 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
@@ -49,13 +49,13 @@ module Storages
def call(auth_strategy:, source_path:, destination_path:)
with_tagged_logger do
Authentication[auth_strategy].call(storage: @storage) do |http|
- valid_input_result = validate_inputs(source_path, destination_path).on_failure { return _1 }
+ valid_input_result = validate_inputs(source_path, destination_path).on_failure { return it }
remote_urls = build_origin_urls(**valid_input_result.result)
- ensure_remote_folder_does_not_exist(http, remote_urls[:destination_url]).on_failure { return _1 }
+ ensure_remote_folder_does_not_exist(http, remote_urls[:destination_url]).on_failure { return it }
- copy_folder(http, **remote_urls).on_failure { return _1 }
+ copy_folder(http, **remote_urls).on_failure { return it }
get_folder_id(auth_strategy, valid_input_result.result[:destination_path])
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_path_to_id_map_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_path_to_id_map_query.rb
index cb0a766c507..338f0aeac99 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_path_to_id_map_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_path_to_id_map_query.rb
@@ -44,7 +44,7 @@ module Storages
def call(auth_strategy:, folder:, depth:)
origin_user_id = Util.origin_user_id(caller: self.class, storage: @storage, auth_strategy:)
- .on_failure { return _1 }
+ .on_failure { return it }
.result
Authentication[auth_strategy].call(storage: @storage, http_options: headers(depth)) do |http|
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb
index 25faa2fa58c..1b1b5da045e 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb
@@ -59,7 +59,7 @@ module Storages
info "Retrieving file information for #{file_ids.join(', ')}"
http_options = Util.ocs_api_request.deep_merge(Util.accept_json)
Authentication[auth_strategy].call(storage: @storage, http_options:) do |http|
- parsed_response = files_info(http, file_ids).on_failure { return _1 }.result
+ parsed_response = files_info(http, file_ids).on_failure { return it }.result
create_storage_file_infos(parsed_response)
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
index a80dc489d77..7dc8a6b6ffe 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
@@ -42,10 +42,10 @@ module Storages
end
def call(auth_strategy:, folder:)
- validate_input_data(folder).on_failure { return _1 }
+ validate_input_data(folder).on_failure { return it }
origin_user = Util.origin_user_id(caller: self.class, storage: @storage, auth_strategy:)
- .on_failure { return _1 }
+ .on_failure { return it }
.result
@location_prefix = CGI.unescape UrlBuilder.path(@storage.uri.path, "remote.php/dav/files", origin_user)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
index e91b8913581..261c2201a65 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
@@ -57,7 +57,7 @@ module Storages
# rubocop:disable Metrics/AbcSize
def call(auth_strategy:, input_data:)
username = Util.origin_user_id(caller: self.class, storage: @storage, auth_strategy:)
- .on_failure { return _1 }
+ .on_failure { return it }
.result
permissions = parse_permission_mask(input_data.user_permissions)
@@ -66,7 +66,7 @@ module Storages
with_tagged_logger do
info "Getting the folder information"
folder_info = FileInfoQuery.call(storage: @storage, auth_strategy:, file_id: input_data.file_id)
- .on_failure { return _1 }
+ .on_failure { return it }
.result
info "Setting permissions #{permissions.inspect} on #{folder_info.location}"
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_path_to_id_map_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_path_to_id_map_query.rb
index 7e4e7aa8299..89fdefe5115 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_path_to_id_map_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_path_to_id_map_query.rb
@@ -50,7 +50,7 @@ module Storages
def call(auth_strategy:, folder:, depth:)
Authentication[auth_strategy].call(storage: @storage) do |http|
fetched_folder = fetch_folder(http, folder)
- .on_failure { return _1 }
+ .on_failure { return it }
.result
file_ids_dictionary = fetched_folder
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
index 9ae19451977..74f88aca9ff 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
@@ -48,7 +48,7 @@ module Storages
def call(auth_strategy:, folder:)
with_tagged_logger do
info "Getting data on all files under folder '#{folder}' using #{auth_strategy.key}"
- validate_input_data(folder).on_failure { return _1 }
+ validate_input_data(folder).on_failure { return it }
Authentication[auth_strategy].call(storage: @storage) do |http|
response = handle_response(http.get(children_url_for(folder) + FIELDS), :value)
diff --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.rb
index 536bb0d68a7..7e058742d6d 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
@@ -63,9 +63,9 @@ module Storages
with_tagged_logger do
Authentication[auth_strategy].call(storage: @storage) do |http|
item = input_data.file_id
- item_exists?(http, item).on_failure { return _1 }
+ item_exists?(http, item).on_failure { return it }
- current_permissions = get_current_permissions(http, item).on_failure { return _1 }.result
+ current_permissions = get_current_permissions(http, item).on_failure { return it }.result
info "Read and write permissions found: #{current_permissions}"
role_to_user_map(input_data).each_pair do |role, user_ids|
diff --git a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
index 02b3ffd016e..29589853c85 100644
--- a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
+++ b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
@@ -183,7 +183,7 @@ RSpec.describe API::V3::Storages::StorageRepresenter, "rendering" do
expect(generated).to have_json_size(2).at_path("_links/prepareUpload")
- project_ids = JSON.parse(generated).dig("_links", "prepareUpload").map { _1.dig("payload", "projectId") }
+ project_ids = JSON.parse(generated).dig("_links", "prepareUpload").map { it.dig("payload", "projectId") }
expect(project_ids)
.to contain_exactly(project_linked_with_upload_permission.id, another_project_linked_with_upload_permission.id)
end
diff --git a/modules/storages/spec/services/storages/file_links/copy_file_links_service_spec.rb b/modules/storages/spec/services/storages/file_links/copy_file_links_service_spec.rb
index 2d16aa348c1..02d7be58cbe 100644
--- a/modules/storages/spec/services/storages/file_links/copy_file_links_service_spec.rb
+++ b/modules/storages/spec/services/storages/file_links/copy_file_links_service_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe Storages::FileLinks::CopyFileLinksService, :webmock do
let(:source_wp) { create_list(:work_package, 5, project: source_storage.project) }
let(:target_wp) { create_list(:work_package, 5, project: target_storage.project) }
- let(:source_links) { source_wp.map { create(:file_link, container: _1, storage: source) } }
+ let(:source_links) { source_wp.map { create(:file_link, container: it, storage: source) } }
# Caller is sending the ids as strings as they need to be serialized for the calling job.
let(:wp_map) { source_wp.map(&:id).zip(target_wp.map(&:id)).to_h.stringify_keys }
diff --git a/modules/storages/spec/services/storages/one_drive_managed_folder_create_service_spec.rb b/modules/storages/spec/services/storages/one_drive_managed_folder_create_service_spec.rb
index bd4daa88702..92a4aba2d63 100644
--- a/modules/storages/spec/services/storages/one_drive_managed_folder_create_service_spec.rb
+++ b/modules/storages/spec/services/storages/one_drive_managed_folder_create_service_spec.rb
@@ -355,7 +355,7 @@ RSpec.describe Storages::OneDriveManagedFolderCreateService, :webmock do
.value!
Storages::Peripherals::Registry.resolve("one_drive.commands.set_permissions")
.call(storage:, auth_strategy:, input_data:)
- .on_failure { p _1.inspect }
+ .on_failure { p it.inspect }
end
def delete_created_folders
diff --git a/script/i18n/generate_languages_translations b/script/i18n/generate_languages_translations
index 33b60ad38df..1568e4ca638 100755
--- a/script/i18n/generate_languages_translations
+++ b/script/i18n/generate_languages_translations
@@ -106,7 +106,7 @@ class CldrTranslations
end
def available_locales
- @available_locales ||= Set.new(Cldr::Export::Data.locales.map { _1.tr("_", "-") })
+ @available_locales ||= Set.new(Cldr::Export::Data.locales.map { it.tr("_", "-") })
end
def ensure_cldr_database_is_downloaded
diff --git a/script/i18n/generate_seeders_i18n_source_file b/script/i18n/generate_seeders_i18n_source_file
index 7349596d4a4..fb8afefb167 100755
--- a/script/i18n/generate_seeders_i18n_source_file
+++ b/script/i18n/generate_seeders_i18n_source_file
@@ -59,7 +59,7 @@ class GenerateSeederSourceTranslationFiles
def call
Source::SeedFile.all
- .group_by { _1.path.dirname }
+ .group_by { it.path.dirname }
.each do |dir, seed_files|
create_crowdin_source_file(dir, seed_files)
end
diff --git a/spec/helpers/error_message_helper_spec.rb b/spec/helpers/error_message_helper_spec.rb
index 33b10965257..dfee1f7a4c3 100644
--- a/spec/helpers/error_message_helper_spec.rb
+++ b/spec/helpers/error_message_helper_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe ErrorMessageHelper do
let(:description) { error_flash[:description] }
def escape_html(array)
- array.map { CGI.escapeHTML _1 }
+ array.map { CGI.escapeHTML it }
end
before do
diff --git a/spec/lib/open_project/access_control_spec.rb b/spec/lib/open_project/access_control_spec.rb
index ddab8dd7f69..2aa3f26c366 100644
--- a/spec/lib/open_project/access_control_spec.rb
+++ b/spec/lib/open_project/access_control_spec.rb
@@ -243,7 +243,7 @@ RSpec.describe OpenProject::AccessControl do
subject(:dependencies) do
described_class.modules
- .find { _1[:name] == :dependent_module }[:dependencies]
+ .find { it[:name] == :dependent_module }[:dependencies]
end
it "can store specified dependencies" do
@@ -481,7 +481,7 @@ RSpec.describe OpenProject::AccessControl do
permissible_on: :project
end
end
- permission_to_disable = described_class.permissions.find { _1.name == :disabled_permission }
+ permission_to_disable = described_class.permissions.find { it.name == :disabled_permission }
permission_to_disable.disable!
end
diff --git a/spec/menus/projects/menu_spec.rb b/spec/menus/projects/menu_spec.rb
index 7b6300d02a3..0e916a730b5 100644
--- a/spec/menus/projects/menu_spec.rb
+++ b/spec/menus/projects/menu_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe Projects::Menu do
end
describe "queries order" do
- subject(:titles) { menu_items.map { _1.children.map(&:title) } }
+ subject(:titles) { menu_items.map { it.children.map(&:title) } }
shared_let(:another_current_user_query) do
ProjectQuery.create!(name: "Another current user query", user: current_user)
diff --git a/spec/migrations/add_validity_period_to_journals_spec.rb b/spec/migrations/add_validity_period_to_journals_spec.rb
index 0ad92b851a8..8268e6c5064 100644
--- a/spec/migrations/add_validity_period_to_journals_spec.rb
+++ b/spec/migrations/add_validity_period_to_journals_spec.rb
@@ -37,8 +37,8 @@ RSpec.describe AddValidityPeriodToJournals, type: :model do
ActiveRecord::Migration.suppress_messages do
described_class
.new
- .tap { _1.migrate(:down) }
- .tap { _1.migrate(:up) }
+ .tap { it.migrate(:down) }
+ .tap { it.migrate(:up) }
end
end
diff --git a/spec/migrations/remove_project_details_widget_spec.rb b/spec/migrations/remove_project_details_widget_spec.rb
index 69c78a28714..18adc48b3f1 100644
--- a/spec/migrations/remove_project_details_widget_spec.rb
+++ b/spec/migrations/remove_project_details_widget_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe RemoveProjectDetailsWidget, type: :model do
ActiveRecord::Migration.suppress_messages do
described_class
.new
- .tap { _1.migrate(:up) }
+ .tap { it.migrate(:up) }
end
end
diff --git a/spec/models/custom_action_spec.rb b/spec/models/custom_action_spec.rb
index 3a34d74a968..de2e5fd39c2 100644
--- a/spec/models/custom_action_spec.rb
+++ b/spec/models/custom_action_spec.rb
@@ -132,7 +132,7 @@ RSpec.describe CustomAction do
expect do
stubbed_instance
.all_actions
- .select { _1.type == :associated_property }
+ .select { it.type == :associated_property }
.each(&:allowed_values)
end.not_to raise_error
end
diff --git a/spec/models/queries/projects/project_query_custom_field_order_spec.rb b/spec/models/queries/projects/project_query_custom_field_order_spec.rb
index d53936e077a..df84d8a50b5 100644
--- a/spec/models/queries/projects/project_query_custom_field_order_spec.rb
+++ b/spec/models/queries/projects/project_query_custom_field_order_spec.rb
@@ -171,7 +171,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
context "for list format" do
let(:possible_values) { %w[100 3 20] }
- let(:id_by_value) { custom_field.possible_values.to_h { [_1.value, _1.id] } }
+ let(:id_by_value) { custom_field.possible_values.to_h { [it.value, it.id] } }
context "if not allowing multi select" do
include_examples "it sorts" do
@@ -183,7 +183,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
# sorting is done by position, and not by value
project_with_cf_value(id_by_value.fetch("100")),
project_with_cf_value(id_by_value.fetch("3")),
- project_with_cf_value(id_by_value.fetch("20")),
+ project_with_cf_value(id_by_value.fetch("20"))
]
end
end
@@ -207,7 +207,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
project_with_cf_value(*id_by_value.fetch_values("20", "100")), # 100, 20
project_with_cf_value(*id_by_value.fetch_values("3")), # 3
project_with_cf_value(*id_by_value.fetch_values("3", "20")), # 3, 20
- project_with_cf_value(*id_by_value.fetch_values("20")), # 20
+ project_with_cf_value(*id_by_value.fetch_values("20")) # 20
]
end
@@ -230,7 +230,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
create(:user, lastname: "A", firstname: "X", login: "ax", mail: "[email protected]")
]
end
- shared_let(:id_by_login) { users.to_h { [_1.login, _1.id] } }
+ shared_let(:id_by_login) { users.to_h { [it.login, it.id] } }
shared_let(:role) { create(:project_role) }
@@ -254,7 +254,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
id_by_login.fetch("ax"),
id_by_login.fetch("ba"),
id_by_login.fetch("bb1"),
- id_by_login.fetch("bb2"),
+ id_by_login.fetch("bb2")
]
end
@@ -280,7 +280,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
id_by_login.fetch_values("ax", "bb1"), # ax, bb1
id_by_login.fetch_values("ba"), # ba
id_by_login.fetch_values("bb1", "ba"), # ba, bb1
- id_by_login.fetch_values("ba", "bb2"), # ba, bb2
+ id_by_login.fetch_values("ba", "bb2") # ba, bb2
]
end
@@ -310,7 +310,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
create(:version, project:, sharing: "system", name: "9")
]
end
- let(:id_by_name) { versions.to_h { [_1.name, _1.id] } }
+ let(:id_by_name) { versions.to_h { [it.name, it.id] } }
context "if not allowing multi select" do
include_examples "it sorts" do
@@ -322,7 +322,7 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" do
project_with_cf_value(id_by_name.fetch("9")),
project_with_cf_value(id_by_name.fetch("10.2")),
project_with_cf_value(id_by_name.fetch("10.10.2")),
- project_with_cf_value(id_by_name.fetch("10.10.10")),
+ project_with_cf_value(id_by_name.fetch("10.10.10"))
]
end
end
diff --git a/spec/models/queries/projects/project_query_spec.rb b/spec/models/queries/projects/project_query_spec.rb
index 00aa55c341d..dedd7ede0af 100644
--- a/spec/models/queries/projects/project_query_spec.rb
+++ b/spec/models/queries/projects/project_query_spec.rb
@@ -366,7 +366,7 @@ RSpec.describe ProjectQuery do
let(:orders) { { name: :asc, project_status: :desc, "cf_#{custom_field.id}": :desc } }
it "leaves the values untouched" do
- expect(instance.orders.to_h { [_1.attribute, _1.direction] })
+ expect(instance.orders.to_h { [it.attribute, it.direction] })
.to eq orders
end
end
@@ -375,7 +375,7 @@ RSpec.describe ProjectQuery do
let(:orders) { { bogus: :desc, cf_1: :desc } } # rubocop:disable Naming/VariableNumber
it "removes the values" do
- expect(instance.orders.to_h { [_1.attribute, _1.direction] })
+ expect(instance.orders.to_h { [it.attribute, it.direction] })
.to be_empty
end
end
@@ -385,7 +385,7 @@ RSpec.describe ProjectQuery do
let(:orders) { { bogus: :desc, name: :desc, cf_0: :desc, "cf_#{custom_field.id}": :desc } } # rubocop:disable Naming/VariableNumber
it "removes only the offending values" do
- expect(instance.orders.to_h { [_1.attribute, _1.direction] })
+ expect(instance.orders.to_h { [it.attribute, it.direction] })
.to eq(name: :desc, "cf_#{custom_field.id}": :desc)
end
end
diff --git a/spec/models/queries/projects/selects/default_spec.rb b/spec/models/queries/projects/selects/default_spec.rb
index 5e49d5e9082..eb369b3d846 100644
--- a/spec/models/queries/projects/selects/default_spec.rb
+++ b/spec/models/queries/projects/selects/default_spec.rb
@@ -41,11 +41,11 @@ RSpec.describe Queries::Projects::Selects::Default do
end
it "doesn't match any key with prefix" do
- expect(keys.map { "x#{_1}" }).to all(not_match(described_class.key))
+ expect(keys.map { "x#{it}" }).to all(not_match(described_class.key))
end
it "doesn't match any key with suffix" do
- expect(keys.map { "#{_1}x" }).to all(not_match(described_class.key))
+ expect(keys.map { "#{it}x" }).to all(not_match(described_class.key))
end
end
end
diff --git a/spec/models/token/ical_token_spec.rb b/spec/models/token/ical_token_spec.rb
index f09c4b2e44b..5af4fa17c67 100644
--- a/spec/models/token/ical_token_spec.rb
+++ b/spec/models/token/ical_token_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe Token::ICal do
# therefore a user needs to be allowed to have N ical tokens per query
ical_token1 = described_class.create(
user:,
- ical_token_query_assignment_attributes: { query:, name: "#{name}_1" }
+ ical_token_query_assignment_attributes: { query:, name: "#{name}it" }
)
ical_token2 = described_class.create(
user:,
@@ -109,11 +109,11 @@ RSpec.describe Token::ICal do
it "a user cannot have N ical tokens per query with the same name" do
ical_token1 = described_class.create(
user:,
- ical_token_query_assignment_attributes: { query:, name: "#{name}_1" }
+ ical_token_query_assignment_attributes: { query:, name: "#{name}it" }
)
ical_token2 = described_class.create(
user:,
- ical_token_query_assignment_attributes: { query:, name: "#{name}_1" }
+ ical_token_query_assignment_attributes: { query:, name: "#{name}it" }
)
expect(ical_token2.errors["ical_token_query_assignment.name"].first).to eq(
@@ -130,7 +130,7 @@ RSpec.describe Token::ICal do
ical_token3 = described_class.create(
user:,
- ical_token_query_assignment_attributes: { query: query2, name: "#{name}_1" }
+ ical_token_query_assignment_attributes: { query: query2, name: "#{name}it" }
)
expect(described_class.where(user_id: user.id)).to contain_exactly(
diff --git a/spec/requests/api/v3/support/api_v3_collection_response.rb b/spec/requests/api/v3/support/api_v3_collection_response.rb
index 4d27c8cf410..4fbe3048212 100644
--- a/spec/requests/api/v3/support/api_v3_collection_response.rb
+++ b/spec/requests/api/v3/support/api_v3_collection_response.rb
@@ -62,7 +62,7 @@ RSpec.shared_examples_for "API V3 collection response" do |total, count, element
it "returns a collection successfully" do
aggregate_failures do
expect(last_response).to have_http_status(expected_status_code)
- errors = JSON.parse(subject).dig("_embedded", "errors")&.map { _1["message"] }
+ errors = JSON.parse(subject).dig("_embedded", "errors")&.map { it["message"] }
expect(errors).to eq([]) if errors # make errors visible in console if any
end
end
diff --git a/spec/seeders/basic_data/global_role_seeder_spec.rb b/spec/seeders/basic_data/global_role_seeder_spec.rb
index eb9da5f2037..0068239a99f 100644
--- a/spec/seeders/basic_data/global_role_seeder_spec.rb
+++ b/spec/seeders/basic_data/global_role_seeder_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe BasicData::GlobalRoleSeeder do
it "gives all assignable permissions to the role" do
expect(GlobalRole.find_by(name: "Project admin").permissions)
- .to match_array(Roles::CreateContract.new(GlobalRole.new, nil).assignable_permissions.map { _1.name.to_sym })
+ .to match_array(Roles::CreateContract.new(GlobalRole.new, nil).assignable_permissions.map { it.name.to_sym })
end
end
end
diff --git a/spec/seeders/basic_data/project_query_role_seeder_spec.rb b/spec/seeders/basic_data/project_query_role_seeder_spec.rb
index b0c6876cc5d..5491e32f3e8 100644
--- a/spec/seeders/basic_data/project_query_role_seeder_spec.rb
+++ b/spec/seeders/basic_data/project_query_role_seeder_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe BasicData::ProjectQueryRoleSeeder do
it "gives all assignable permissions to the role" do
role = ProjectQueryRole.find_by(name: "All Project Query Permissions")
- expected_roles = Roles::CreateContract.new(ProjectQueryRole.new, nil).assignable_permissions.map { _1.name.to_sym }
+ expected_roles = Roles::CreateContract.new(ProjectQueryRole.new, nil).assignable_permissions.map { it.name.to_sym }
expect(role.permissions).to match_array(expected_roles)
end
end
diff --git a/spec/seeders/basic_data/project_role_seeder_spec.rb b/spec/seeders/basic_data/project_role_seeder_spec.rb
index 59e13293f6e..db675c16e71 100644
--- a/spec/seeders/basic_data/project_role_seeder_spec.rb
+++ b/spec/seeders/basic_data/project_role_seeder_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe BasicData::ProjectRoleSeeder do
it "gives all assignable permissions to the role" do
expect(Role.find_by(name: "Project admin").permissions)
- .to match_array(Roles::CreateContract.new(Role.new, nil).assignable_permissions(keep_public: true).map { _1.name.to_sym })
+ .to match_array(Roles::CreateContract.new(Role.new, nil).assignable_permissions(keep_public: true).map { it.name.to_sym })
end
it "includes the project attributes permissions to the role" do
diff --git a/spec/seeders/basic_data/work_package_role_seeder_spec.rb b/spec/seeders/basic_data/work_package_role_seeder_spec.rb
index 5eb86397ef2..b274b897eaf 100644
--- a/spec/seeders/basic_data/work_package_role_seeder_spec.rb
+++ b/spec/seeders/basic_data/work_package_role_seeder_spec.rb
@@ -104,7 +104,7 @@ RSpec.describe BasicData::WorkPackageRoleSeeder do
it "gives all assignable permissions to the role" do
expect(Role.find_by(name: "Edit work package").permissions)
.to match_array(Roles::CreateContract.new(WorkPackageRole.new, nil)
- .assignable_permissions.map { _1.name.to_sym })
+ .assignable_permissions.map { it.name.to_sym })
end
end
diff --git a/spec/seeders/setting_seeder_spec.rb b/spec/seeders/setting_seeder_spec.rb
index ac206441d32..e22957a929d 100644
--- a/spec/seeders/setting_seeder_spec.rb
+++ b/spec/seeders/setting_seeder_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe BasicData::SettingSeeder do
it "does not seed settings whose default value is undefined" do
setting_seeder.seed!
- names_of_undefined_settings = Settings::Definition.all.values.select { _1.value == nil }.map(&:name)
+ names_of_undefined_settings = Settings::Definition.all.values.select { it.value == nil }.map(&:name)
# these ones are special as their value is set based on database ids
names_of_undefined_settings -= ["new_project_user_role_id", "commit_fix_status_id"]
expect(Setting.where(name: names_of_undefined_settings).pluck(:name)).to be_empty
diff --git a/spec/services/members/set_attributes_service_spec.rb b/spec/services/members/set_attributes_service_spec.rb
index c9b11ada380..e42f0c79a8b 100644
--- a/spec/services/members/set_attributes_service_spec.rb
+++ b/spec/services/members/set_attributes_service_spec.rb
@@ -116,7 +116,7 @@ RSpec.describe Members::SetAttributesService, type: :model do
it "adds the new role and marks the other for destruction" do
expect(subject.result.member_roles.map(&:role_id)).to contain_exactly(first_role.id, second_role.id, third_role.id)
- expect(subject.result.member_roles.detect { _1.role_id == first_role.id }).to be_marked_for_destruction
+ expect(subject.result.member_roles.detect { it.role_id == first_role.id }).to be_marked_for_destruction
end
end
diff --git a/spec/services/service_result_spec.rb b/spec/services/service_result_spec.rb
index c9cb99a46b1..62b3ffad8ec 100644
--- a/spec/services/service_result_spec.rb
+++ b/spec/services/service_result_spec.rb
@@ -223,7 +223,7 @@ RSpec.describe ServiceResult, type: :model do
let(:message) { "some message" }
subject(:flash) do
- {}.tap { service_result.apply_flash_message!(_1) }
+ {}.tap { service_result.apply_flash_message!(it) }
end
context "when successful" do
diff --git a/spec/services/shares/set_attributes_service_spec.rb b/spec/services/shares/set_attributes_service_spec.rb
index c4f3a8e4635..1708ab8356d 100644
--- a/spec/services/shares/set_attributes_service_spec.rb
+++ b/spec/services/shares/set_attributes_service_spec.rb
@@ -163,7 +163,7 @@ RSpec.describe Shares::SetAttributesService, type: :model do
it "adds the new role and marks the other for destruction" do
expect(subject.result.member_roles.map(&:role_id)).to contain_exactly(first_role.id, second_role.id, third_role.id)
- expect(subject.result.member_roles.detect { _1.role_id == first_role.id }).to be_marked_for_destruction
+ expect(subject.result.member_roles.detect { it.role_id == first_role.id }).to be_marked_for_destruction
end
context "when a role being assigned is already inherited via a group" do
@@ -172,7 +172,7 @@ RSpec.describe Shares::SetAttributesService, type: :model do
end
before do
- allow(member.member_roles.detect { _1.role_id == third_role.id })
+ allow(member.member_roles.detect { it.role_id == third_role.id })
.to receive(:inherited_from)
.and_return(true)
end
diff --git a/spec/services/work_packages/schedule_dependency/dependency_spec.rb b/spec/services/work_packages/schedule_dependency/dependency_spec.rb
index 01cfb241733..d76a7eb7eab 100644
--- a/spec/services/work_packages/schedule_dependency/dependency_spec.rb
+++ b/spec/services/work_packages/schedule_dependency/dependency_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe WorkPackages::ScheduleDependency::Dependency do
def checked_dependency_for(work_package)
dependency_for(work_package).tap do |dependency|
if dependency.nil?
- available = schedule_dependency.dependencies.keys.map { _1.subject.inspect }.to_sentence
+ available = schedule_dependency.dependencies.keys.map { it.subject.inspect }.to_sentence
raise ArgumentError, "Unable to find dependency for work package #{work_package.subject.inspect}; " \
"ScheduleDependency instance has dependencies for work packages #{available}"
end
diff --git a/spec/services/work_packages/set_attributes_service/shared_examples.rb b/spec/services/work_packages/set_attributes_service/shared_examples.rb
index 6b6b4cbb5dd..319d3d78091 100644
--- a/spec/services/work_packages/set_attributes_service/shared_examples.rb
+++ b/spec/services/work_packages/set_attributes_service/shared_examples.rb
@@ -93,7 +93,7 @@ RSpec.shared_examples_for "update progress values" do |description:, expected_hi
expect(work_package).to have_attributes(all_expected_attributes)
expect(work_package).to have_attributes(set_attributes.except(*all_expected_attributes.keys))
if expected_hints
- expected_hints = expected_hints.transform_keys { to_work_package_field(_1) }
+ expected_hints = expected_hints.transform_keys { to_work_package_field(it) }
expect(compact_progress_hints(work_package)).to eq(expected_hints)
end
# work package is not saved and no errors are created
diff --git a/spec/support/components/attachments_list.rb b/spec/support/components/attachments_list.rb
index d2f1751c108..6d0c971d1fc 100644
--- a/spec/support/components/attachments_list.rb
+++ b/spec/support/components/attachments_list.rb
@@ -43,7 +43,7 @@ module Components
end
def wait_until_visible
- element.tap { scroll_to_element(_1) }
+ element.tap { scroll_to_element(it) }
end
def element
diff --git a/spec/support/edit_fields/progress_edit_field.rb b/spec/support/edit_fields/progress_edit_field.rb
index 17fc5e4e22d..0cd3d0d171d 100644
--- a/spec/support/edit_fields/progress_edit_field.rb
+++ b/spec/support/edit_fields/progress_edit_field.rb
@@ -285,7 +285,7 @@ class ProgressEditField < EditField
def input_aria_related_element(describedby:)
input_element["aria-describedby"]
.split
- .find { _1.start_with?("#{describedby}-") }
+ .find { it.start_with?("#{describedby}-") }
&.then { |id| find(id:) }
end
end
diff --git a/spec/support/matchers/eq_array.rb b/spec/support/matchers/eq_array.rb
index f0f2e7a4b3a..94b5ac855ac 100644
--- a/spec/support/matchers/eq_array.rb
+++ b/spec/support/matchers/eq_array.rb
@@ -31,7 +31,7 @@
# Differ is private, so this can break at any moment
# Example:
# expect([1, 2, 3]).to eq_array [2, 3, 4]
-# expect(actual).to eq_array(expected) { [_1.id, _1.value] }
+# expect(actual).to eq_array(expected) { [it.id, it.value] }
RSpec::Matchers.define :eq_array do |expected|
match { |actual| expected == actual }
diff --git a/spec/support/pages/members.rb b/spec/support/pages/members.rb
index b00459a83c0..df0ec5bebc9 100644
--- a/spec/support/pages/members.rb
+++ b/spec/support/pages/members.rb
@@ -111,7 +111,7 @@ module Pages
end
def click_row_action!(row, action)
- action_menu_button = row.find(:link_or_button) { _1.has_selector?("svg.octicon-kebab-horizontal") }
+ action_menu_button = row.find(:link_or_button) { it.has_selector?("svg.octicon-kebab-horizontal") }
action_menu_button.click
diff --git a/spec/support/permission_specs.rb b/spec/support/permission_specs.rb
index 0290cd86684..cbe0d2856b6 100644
--- a/spec/support/permission_specs.rb
+++ b/spec/support/permission_specs.rb
@@ -43,10 +43,10 @@ module PermissionSpecs
def self.controller_actions
Rails.application.routes.routes
.map(&:defaults)
- .select { _1[:controller] == described_class.controller_path }
+ .select { it[:controller] == described_class.controller_path }
.pluck(:action)
.uniq
- .select { described_class.action_methods.include?(_1) }
+ .select { described_class.action_methods.include?(it) }
.sort
end
diff --git a/spec/support/pry.rb b/spec/support/pry.rb
index 02d41c99964..1ffb6e36ff3 100644
--- a/spec/support/pry.rb
+++ b/spec/support/pry.rb
@@ -45,7 +45,7 @@ RSpec.configure do |config|
config.after(pry: true) do |example|
if example.exception
exception_message = example.exception.message
- backtrace_locations = example.exception.backtrace_locations.filter { _1.to_s.include? "/spec/" }
+ backtrace_locations = example.exception.backtrace_locations.filter { it.to_s.include? "/spec/" }
puts
puts exception_message
diff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rb
index 67bb88b10f2..0bc2e360f07 100644
--- a/spec/support/rspec_retry.rb
+++ b/spec/support/rspec_retry.rb
@@ -64,7 +64,7 @@ def retry_block(args: {}, screenshot: false, &)
#{exception.class}: '#{exception.message}'
occurred on #{exception_source_lines.first}
backtrace:
- #{exception_source_lines.map { " #{_1}" }.join("\n")}
+ #{exception_source_lines.map { " #{it}" }.join("\n")}
ran #{try} #{'try'.pluralize(try)} in #{elapsed_time} seconds, #{next_try_message}.
--
MSG
diff --git a/spec/support/seeders.rb b/spec/support/seeders.rb
index 7bbc81700dd..cfcf67c7c04 100644
--- a/spec/support/seeders.rb
+++ b/spec/support/seeders.rb
@@ -48,7 +48,7 @@ RSpec.shared_context "with basic seed data" do |edition: "standard"|
shared_let(:needed_seeders_keys) do
# warning: there is one limitation: RoleSeeder will only pick 'roles' key,
# and not 'modules_permissions' key.
- needed_seeders.map { _1.try(:seed_data_model_key) }.compact
+ needed_seeders.map { it.try(:seed_data_model_key) }.compact
end
shared_let(:basic_seed_data) do
Source::SeedDataLoader.get_data(edition:).only(*needed_seeders_keys)
diff --git a/spec/support/table_helpers/column_type/hierarchy.rb b/spec/support/table_helpers/column_type/hierarchy.rb
index 7e5fdead882..ce142b5e41b 100644
--- a/spec/support/table_helpers/column_type/hierarchy.rb
+++ b/spec/support/table_helpers/column_type/hierarchy.rb
@@ -69,8 +69,8 @@ module TableHelpers
work_packages_data
.slice(0, data[:index])
.reverse
- .find { _1[:hierarchy_indent] < hierarchy_indent }
- .then { _1&.fetch(:identifier) }
+ .find { it[:hierarchy_indent] < hierarchy_indent }
+ .then { it&.fetch(:identifier) }
end
end
end
diff --git a/spec/support_spec/table_helpers/table_parser_spec.rb b/spec/support_spec/table_helpers/table_parser_spec.rb
index f45cdb63a1c..481122af2df 100644
--- a/spec/support_spec/table_helpers/table_parser_spec.rb
+++ b/spec/support_spec/table_helpers/table_parser_spec.rb
@@ -128,12 +128,12 @@ RSpec.describe TableHelpers::TableParser do
end
it "sets the parent attribute by its identifier" do
- attributes = parsed_data.flat_map { _1[:attributes] }
+ attributes = parsed_data.flat_map { it[:attributes] }
expect(attributes.pluck(:parent)).to eq([nil, :parent, :child, :parent, :parent, :child3, nil])
end
it "sets the subject attribute" do
- attributes = parsed_data.flat_map { _1[:attributes] }
+ attributes = parsed_data.flat_map { it[:attributes] }
expect(attributes.pluck(:subject))
.to eq(["Parent", "Child", "Grand-Child", "Child 2", "Child 3", "Another child", "Root sibling"])
end