diff options
Diffstat (limited to 'spec/models')
54 files changed, 173 insertions, 173 deletions
diff --git a/spec/models/alert_management/http_integration_spec.rb b/spec/models/alert_management/http_integration_spec.rb index dc26d0323d7..ef9eaa960f2 100644 --- a/spec/models/alert_management/http_integration_spec.rb +++ b/spec/models/alert_management/http_integration_spec.rb @@ -44,8 +44,8 @@ RSpec.describe AlertManagement::HttpIntegration, feature_category: :incident_man context 'with valid JSON schema' do let(:attribute_mapping) do { - title: { path: %w(a b c), type: 'string', label: 'Title' }, - description: { path: %w(a), type: 'string' } + title: { path: %w[a b c], type: 'string', label: 'Title' }, + description: { path: %w[a], type: 'string' } } end @@ -78,7 +78,7 @@ RSpec.describe AlertManagement::HttpIntegration, feature_category: :incident_man context 'when property has extra attributes' do let(:attribute_mapping) do - { title: { path: %w(a b c), type: 'string', extra: 'property' } } + { title: { path: %w[a b c], type: 'string', extra: 'property' } } end it_behaves_like 'is invalid record' diff --git a/spec/models/appearance_spec.rb b/spec/models/appearance_spec.rb index b5f47c950b9..ffb46884e5d 100644 --- a/spec/models/appearance_spec.rb +++ b/spec/models/appearance_spec.rb @@ -81,7 +81,7 @@ RSpec.describe Appearance do end end - %i(logo header_logo pwa_icon favicon).each do |logo_type| + %i[logo header_logo pwa_icon favicon].each do |logo_type| it_behaves_like 'logo paths', logo_type end diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 78bf410075b..59701f52f28 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -254,11 +254,11 @@ RSpec.describe ApplicationSetting, feature_category: :shared, type: :model do it { is_expected.not_to allow_value(['']).for(:valid_runner_registrars) } it { is_expected.not_to allow_value(['OBVIOUSLY_WRONG']).for(:valid_runner_registrars) } - it { is_expected.not_to allow_value(%w(project project)).for(:valid_runner_registrars) } + it { is_expected.not_to allow_value(%w[project project]).for(:valid_runner_registrars) } it { is_expected.not_to allow_value([nil]).for(:valid_runner_registrars) } it { is_expected.not_to allow_value(nil).for(:valid_runner_registrars) } it { is_expected.to allow_value([]).for(:valid_runner_registrars) } - it { is_expected.to allow_value(%w(project group)).for(:valid_runner_registrars) } + it { is_expected.to allow_value(%w[project group]).for(:valid_runner_registrars) } it { is_expected.to allow_value(http).for(:jira_connect_proxy_url) } it { is_expected.to allow_value(https).for(:jira_connect_proxy_url) } @@ -878,9 +878,9 @@ RSpec.describe ApplicationSetting, feature_category: :shared, type: :model do describe 'inclusion' do it { is_expected.to allow_value('custom1').for(:repository_storages) } - it { is_expected.to allow_value(%w(custom2 custom3)).for(:repository_storages) } + it { is_expected.to allow_value(%w[custom2 custom3]).for(:repository_storages) } it { is_expected.not_to allow_value('alternative').for(:repository_storages) } - it { is_expected.not_to allow_value(%w(alternative custom1)).for(:repository_storages) } + it { is_expected.not_to allow_value(%w[alternative custom1]).for(:repository_storages) } end describe 'presence' do diff --git a/spec/models/authentication_event_spec.rb b/spec/models/authentication_event_spec.rb index 17fe10b5b4e..8ce949c737b 100644 --- a/spec/models/authentication_event_spec.rb +++ b/spec/models/authentication_event_spec.rb @@ -37,11 +37,11 @@ RSpec.describe AuthenticationEvent do describe '.providers' do before do - allow(Devise).to receive(:omniauth_providers).and_return(%w(ldapmain google_oauth2)) + allow(Devise).to receive(:omniauth_providers).and_return(%w[ldapmain google_oauth2]) end it 'returns an array of distinct providers' do - expect(described_class.providers).to match_array %w(ldapmain google_oauth2 standard two-factor two-factor-via-u2f-device two-factor-via-webauthn-device) + expect(described_class.providers).to match_array %w[ldapmain google_oauth2 standard two-factor two-factor-via-u2f-device two-factor-via-webauthn-device] end end diff --git a/spec/models/blob_viewer/base_spec.rb b/spec/models/blob_viewer/base_spec.rb index 682b6dc3b1d..91c32d5c7c9 100644 --- a/spec/models/blob_viewer/base_spec.rb +++ b/spec/models/blob_viewer/base_spec.rb @@ -11,7 +11,7 @@ RSpec.describe BlobViewer::Base do Class.new(described_class) do include BlobViewer::ServerSide - self.extensions = %w(pdf) + self.extensions = %w[pdf] self.binary = true self.collapse_limit = 1.megabyte self.size_limit = 5.megabytes @@ -41,7 +41,7 @@ RSpec.describe BlobViewer::Base do context 'when the file type is supported' do before do - viewer_class.file_types = %i(license) + viewer_class.file_types = %i[license] viewer_class.binary = false end diff --git a/spec/models/ci/build_dependencies_spec.rb b/spec/models/ci/build_dependencies_spec.rb index ab32234eba3..f80af7b9dbc 100644 --- a/spec/models/ci/build_dependencies_spec.rb +++ b/spec/models/ci/build_dependencies_spec.rb @@ -107,7 +107,7 @@ RSpec.describe Ci::BuildDependencies, feature_category: :continuous_integration end context 'when dependencies are defined' do - let(:dependencies) { %w(rspec staging) } + let(:dependencies) { %w[rspec staging] } it { is_expected.to contain_exactly(rspec_test, staging) } end @@ -137,7 +137,7 @@ RSpec.describe Ci::BuildDependencies, feature_category: :continuous_integration end context 'when needs and dependencies are defined' do - let(:dependencies) { %w(rspec staging) } + let(:dependencies) { %w[rspec staging] } let(:needs) do [ { name: 'build', artifacts: true }, @@ -150,7 +150,7 @@ RSpec.describe Ci::BuildDependencies, feature_category: :continuous_integration end context 'when needs and dependencies contradict' do - let(:dependencies) { %w(rspec staging) } + let(:dependencies) { %w[rspec staging] } let(:needs) do [ { name: 'build', artifacts: true }, diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index e2e13ea0e17..19087d00991 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -87,7 +87,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def describe 'status' do context 'when transitioning to any state from running' do it 'removes runner_session' do - %w(success drop cancel).each do |event| + %w[success drop cancel].each do |event| build = FactoryBot.create(:ci_build, :running, :with_runner_session, pipeline: pipeline) build.fire_events!(event) @@ -1090,7 +1090,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def let(:options_with_fallback_keys) do { cache: [ - { key: "key", paths: ["public"], policy: "pull-push", fallback_keys: %w(key1 key2) } + { key: "key", paths: ["public"], policy: "pull-push", fallback_keys: %w[key1 key2] } ] } end @@ -1111,8 +1111,8 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def let(:options_with_fallback_keys) do { cache: [ - { key: "key", paths: ["public"], policy: "pull-push", fallback_keys: %w(key3 key4) }, - { key: "key2", paths: ["public"], policy: "pull-push", fallback_keys: %w(key5 key6) } + { key: "key", paths: ["public"], policy: "pull-push", fallback_keys: %w[key3 key4] }, + { key: "key2", paths: ["public"], policy: "pull-push", fallback_keys: %w[key5 key6] } ] } end @@ -1214,11 +1214,11 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def is_expected.to match([ a_hash_including({ key: 'key-1', - fallback_keys: %w(key3-1 key4-1) + fallback_keys: %w[key3-1 key4-1] }), a_hash_including({ key: 'key2-1', - fallback_keys: %w(key5-1 key6-1) + fallback_keys: %w[key5-1 key6-1] }) ]) end @@ -1241,11 +1241,11 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def is_expected.to match([ a_hash_including({ key: 'key-1', - fallback_keys: %w(key3-1 key4-1) + fallback_keys: %w[key3-1 key4-1] }), a_hash_including({ key: 'key2-1', - fallback_keys: %w(key5-1 key6-1) + fallback_keys: %w[key5-1 key6-1] }) ]) end @@ -1320,7 +1320,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def allow(build).to receive(:options).and_return({ cache: [{ key: "key1", - fallback_keys: %w(key2) + fallback_keys: %w[key2] }] }) end @@ -2951,7 +2951,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def end context 'when runner is assigned to build' do - let(:runner) { create(:ci_runner, description: 'description', tag_list: %w(docker linux)) } + let(:runner) { create(:ci_runner, description: 'description', tag_list: %w[docker linux]) } before do build.update!(runner: runner) @@ -3952,8 +3952,8 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def end context 'when have different tags' do - let(:build_tag_list) { %w(A B) } - let(:tag_list) { %w(C D) } + let(:build_tag_list) { %w[A B] } + let(:tag_list) { %w[C D] } it "does not match a build" do is_expected.not_to contain_exactly(build) @@ -3961,8 +3961,8 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def end context 'when have a subset of tags' do - let(:build_tag_list) { %w(A B) } - let(:tag_list) { %w(A B C D) } + let(:build_tag_list) { %w[A B] } + let(:tag_list) { %w[A B C D] } it "does match a build" do is_expected.to contain_exactly(build) @@ -3971,7 +3971,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def context 'when build does not have tags' do let(:build_tag_list) { [] } - let(:tag_list) { %w(C D) } + let(:tag_list) { %w[C D] } it "does match a build" do is_expected.to contain_exactly(build) @@ -3979,8 +3979,8 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def end context 'when does not have a subset of tags' do - let(:build_tag_list) { %w(A B C) } - let(:tag_list) { %w(C D) } + let(:build_tag_list) { %w[A B C] } + let(:tag_list) { %w[C D] } it "does not match a build" do is_expected.not_to contain_exactly(build) @@ -3998,7 +3998,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def end context 'when does have tags' do - let(:tag_list) { %w(A B) } + let(:tag_list) { %w[A B] } it "does match a build" do is_expected.to contain_exactly(build) @@ -4676,7 +4676,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def describe '#invalid_dependencies' do let!(:pre_stage_job_valid) { create(:ci_build, :manual, pipeline: pipeline, name: 'test1', stage_idx: 0) } let!(:pre_stage_job_invalid) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test2', stage_idx: 1) } - let!(:job) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) } + let!(:job) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w[test1 test2] }) } context 'when pipeline is locked' do before do diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index 498af80dbb6..48d46824c11 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -207,7 +207,7 @@ RSpec.describe Ci::JobArtifact, feature_category: :build_artifacts do subject { described_class.associated_file_types_for(file_type) } where(:file_type, :result) do - 'codequality' | %w(codequality) + 'codequality' | %w[codequality] 'quality' | nil end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index e0ca7276dc4..9d2c7e876c3 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -1303,7 +1303,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category: describe '#stages_names' do it 'returns a valid names of stages' do - expect(pipeline.stages_names).to eq(%w(build test deploy)) + expect(pipeline.stages_names).to eq(%w[build test deploy]) end end end @@ -2640,7 +2640,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category: subject(:latest_successful_for_refs) { described_class.latest_successful_for_refs(refs) } context 'when refs are specified' do - let(:refs) { %w(first_ref second_ref third_ref) } + let(:refs) { %w[first_ref second_ref third_ref] } before do create(:ci_empty_pipeline, id: 1001, status: :success, ref: 'first_ref', sha: 'sha') diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 538eb51387e..bb9ac084ed6 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -772,7 +772,7 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do end context 'when runner has tags' do - let(:tag_list) { %w(bb cc) } + let(:tag_list) { %w[bb cc] } shared_examples 'tagged build picker' do it 'can handle build with matching tags' do diff --git a/spec/models/clusters/agent_spec.rb b/spec/models/clusters/agent_spec.rb index 6201b7b1861..062d5062658 100644 --- a/spec/models/clusters/agent_spec.rb +++ b/spec/models/clusters/agent_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Clusters::Agent, feature_category: :deployment_management do describe 'scopes' do describe '.ordered_by_name' do - let(:names) { %w(agent-d agent-b agent-a agent-c) } + let(:names) { %w[agent-d agent-b agent-a agent-c] } subject { described_class.ordered_by_name } diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index c32abaf50f5..79a81977611 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Clusters::Platforms::Kubernetes do it { is_expected.to be_kind_of(Gitlab::Kubernetes) } it { is_expected.to respond_to :ca_pem } - it { is_expected.to validate_exclusion_of(:namespace).in_array(%w(gitlab-managed-apps)) } + it { is_expected.to validate_exclusion_of(:namespace).in_array(%w[gitlab-managed-apps]) } it { is_expected.to validate_presence_of(:api_url) } it { is_expected.to validate_presence_of(:token) } diff --git a/spec/models/commit_range_spec.rb b/spec/models/commit_range_spec.rb index 334833e884b..fe8c28d7251 100644 --- a/spec/models/commit_range_spec.rb +++ b/spec/models/commit_range_spec.rb @@ -77,7 +77,7 @@ RSpec.describe CommitRange do describe '#to_param' do it 'includes the correct keys' do - expect(range.to_param.keys).to eq %i(from to) + expect(range.to_param.keys).to eq %i[from to] end it 'includes the correct values for a three-dot range' do diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 7ab43611108..f9885d9081e 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -23,13 +23,13 @@ RSpec.describe Commit do shared_examples '.lazy checks' do context 'when the commits are found' do let(:oids) do - %w( + %w[ 498214de67004b1da3d820901307bed2a68a8ef6 c642fe9b8b9f28f9225d7ea953fe14e74748d53b 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 048721d90c449b244b7b4c53a9186b04330174ec 281d3a76f31c812dbf48abce82ccf6860adedd81 - ) + ] end subject { oids.map { |oid| described_class.lazy(container, oid) } } diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 9371fde4d4b..618dd3a3f77 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -27,7 +27,7 @@ RSpec.describe CommitStatus, feature_category: :continuous_integration do it { is_expected.to belong_to(:auto_canceled_by) } it { is_expected.to validate_presence_of(:name) } - it { is_expected.to validate_inclusion_of(:status).in_array(%w(pending running failed success canceled)) } + it { is_expected.to validate_inclusion_of(:status).in_array(%w[pending running failed success canceled]) } it { is_expected.to validate_length_of(:stage).is_at_most(255) } it { is_expected.to validate_length_of(:ref).is_at_most(255) } diff --git a/spec/models/compare_spec.rb b/spec/models/compare_spec.rb index 2206ed7bfe8..78610d002b2 100644 --- a/spec/models/compare_spec.rb +++ b/spec/models/compare_spec.rb @@ -129,13 +129,13 @@ RSpec.describe Compare, feature_category: :source_code_management do it 'returns affected file paths, without duplication' do expect(subject.modified_paths).to contain_exactly( - *%w{ + *%w[ foo/for_move.txt foo/bar/for_move.txt foo/for_create.txt foo/for_delete.txt foo/for_edit.txt - }) + ]) end end diff --git a/spec/models/concerns/awardable_spec.rb b/spec/models/concerns/awardable_spec.rb index fcd0d0c05f4..828b75aceb0 100644 --- a/spec/models/concerns/awardable_spec.rb +++ b/spec/models/concerns/awardable_spec.rb @@ -102,7 +102,7 @@ RSpec.describe Awardable do end it "includes unused thumbs buttons by default" do - expect(note_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) + expect(note_without_downvote.grouped_awards.keys.sort).to eq %w[thumbsdown thumbsup] end it "doesn't include unused thumbs buttons when disabled in project" do @@ -114,7 +114,7 @@ RSpec.describe Awardable do it "includes unused thumbs buttons when enabled in project" do note_without_downvote.project.show_default_award_emojis = true - expect(note_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) + expect(note_without_downvote.grouped_awards.keys.sort).to eq %w[thumbsdown thumbsup] end it "doesn't include unused thumbs buttons in summary" do @@ -124,11 +124,11 @@ RSpec.describe Awardable do it "includes used thumbs buttons when disabled in project" do note_with_downvote.project.show_default_award_emojis = false - expect(note_with_downvote.grouped_awards.keys).to eq %w(thumbsdown) + expect(note_with_downvote.grouped_awards.keys).to eq %w[thumbsdown] end it "includes used thumbs buttons in summary" do - expect(note_with_downvote.grouped_awards(with_thumbs: false).keys).to eq %w(thumbsdown) + expect(note_with_downvote.grouped_awards(with_thumbs: false).keys).to eq %w[thumbsdown] end end end diff --git a/spec/models/concerns/case_sensitivity_spec.rb b/spec/models/concerns/case_sensitivity_spec.rb index 6e624c687c4..a8e52904873 100644 --- a/spec/models/concerns/case_sensitivity_spec.rb +++ b/spec/models/concerns/case_sensitivity_spec.rb @@ -21,11 +21,11 @@ RSpec.describe CaseSensitivity do end it 'finds multiple instances by a single attribute regardless of case' do - expect(model.iwhere(path: %w(MODEL-1 model-2))).to contain_exactly(model_1, model_2) + expect(model.iwhere(path: %w[MODEL-1 model-2])).to contain_exactly(model_1, model_2) end it 'finds instances by multiple attributes' do - expect(model.iwhere(path: %w(MODEL-1 model-2), name: 'model 1')) + expect(model.iwhere(path: %w[MODEL-1 model-2], name: 'model 1')) .to contain_exactly(model_1) end @@ -34,7 +34,7 @@ RSpec.describe CaseSensitivity do end it 'builds a query using LOWER' do - query = model.iwhere(path: %w(MODEL-1 model-2), name: 'model 1').to_sql + query = model.iwhere(path: %w[MODEL-1 model-2], name: 'model 1').to_sql expected_query = <<~QRY.strip SELECT \"namespaces\".* FROM \"namespaces\" WHERE (LOWER(\"namespaces\".\"path\") IN (LOWER('MODEL-1'), LOWER('model-2'))) AND (LOWER(\"namespaces\".\"name\") = LOWER('model 1')) QRY diff --git a/spec/models/concerns/featurable_spec.rb b/spec/models/concerns/featurable_spec.rb index bf104fe1b30..97ad4fc8bdd 100644 --- a/spec/models/concerns/featurable_spec.rb +++ b/spec/models/concerns/featurable_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Featurable do self.table_name = 'project_features' - set_available_features %i(feature1 feature2 feature3) + set_available_features %i[feature1 feature2 feature3] def feature1_access_level Featurable::DISABLED diff --git a/spec/models/concerns/ignorable_columns_spec.rb b/spec/models/concerns/ignorable_columns_spec.rb index c97dc606159..339f06f9c45 100644 --- a/spec/models/concerns/ignorable_columns_spec.rb +++ b/spec/models/concerns/ignorable_columns_spec.rb @@ -14,13 +14,13 @@ RSpec.describe IgnorableColumns do it 'adds columns to ignored_columns' do expect do subject.ignore_columns(:name, :created_at, remove_after: '2019-12-01', remove_with: '12.6') - end.to change { subject.ignored_columns }.from([]).to(%w(name created_at)) + end.to change { subject.ignored_columns }.from([]).to(%w[name created_at]) end it 'adds columns to ignored_columns (array version)' do expect do subject.ignore_columns(%i[name created_at], remove_after: '2019-12-01', remove_with: '12.6') - end.to change { subject.ignored_columns }.from([]).to(%w(name created_at)) + end.to change { subject.ignored_columns }.from([]).to(%w[name created_at]) end it 'requires remove_after attribute to be set' do diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 705f8f46a90..d61a465b39f 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -597,7 +597,7 @@ RSpec.describe Issuable, feature_category: :team_planning do expect(builder).to receive(:build).with( user: user, changes: hash_including( - 'severity' => %w(unknown low) + 'severity' => %w[unknown low] )) issue.to_hook_data(user, old_associations: { severity: 'unknown' }) @@ -618,7 +618,7 @@ RSpec.describe Issuable, feature_category: :team_planning do expect(builder).to receive(:build).with( user: user, changes: hash_including( - 'escalation_status' => %i(triggered acknowledged) + 'escalation_status' => %i[triggered acknowledged] )) issue.to_hook_data(user, old_associations: { escalation_status: :triggered }) diff --git a/spec/models/concerns/pg_full_text_searchable_spec.rb b/spec/models/concerns/pg_full_text_searchable_spec.rb index 059df64f7d0..8e3b65cf125 100644 --- a/spec/models/concerns/pg_full_text_searchable_spec.rb +++ b/spec/models/concerns/pg_full_text_searchable_spec.rb @@ -18,7 +18,7 @@ RSpec.describe PgFullTextSearchable, feature_category: :global_search do before_validation -> { self.work_item_type_id = ::WorkItems::Type.default_issue_type.id } def persist_pg_full_text_search_vector(search_vector) - Issues::SearchData.upsert({ project_id: project_id, issue_id: id, search_vector: search_vector }, unique_by: %i(project_id issue_id)) + Issues::SearchData.upsert({ project_id: project_id, issue_id: id, search_vector: search_vector }, unique_by: %i[project_id issue_id]) end def self.name @@ -95,7 +95,7 @@ RSpec.describe PgFullTextSearchable, feature_category: :global_search do matching_object = model_class.create!(project: project, namespace: project.project_namespace, title: 'english', description: 'some description') matching_object.update_search_data! - expect(model_class.pg_full_text_search('english', matched_columns: %w(title))).to contain_exactly(matching_object) + expect(model_class.pg_full_text_search('english', matched_columns: %w[title])).to contain_exactly(matching_object) end it 'uses prefix matching' do diff --git a/spec/models/concerns/project_features_compatibility_spec.rb b/spec/models/concerns/project_features_compatibility_spec.rb index f168bedc8eb..46390fa735b 100644 --- a/spec/models/concerns/project_features_compatibility_spec.rb +++ b/spec/models/concerns/project_features_compatibility_spec.rb @@ -4,12 +4,12 @@ require 'spec_helper' RSpec.describe ProjectFeaturesCompatibility do let(:project) { create(:project) } - let(:features_enabled) { %w(issues wiki builds merge_requests snippets security_and_compliance) } + let(:features_enabled) { %w[issues wiki builds merge_requests snippets security_and_compliance] } let(:features) do - features_enabled + %w( + features_enabled + %w[ repository pages operations container_registry package_registry environments feature_flags releases monitor infrastructure - ) + ] end # We had issues_enabled, snippets_enabled, builds_enabled, merge_requests_enabled and issues_enabled fields on projects table diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb index 039b9e574fe..324759fc7ee 100644 --- a/spec/models/concerns/reactive_caching_spec.rb +++ b/spec/models/concerns/reactive_caching_spec.rb @@ -176,7 +176,7 @@ RSpec.describe ReactiveCaching, :use_clean_rails_memory_store_caching do describe '.reactive_cache_worker_finder' do context 'with default reactive_cache_worker_finder' do - let(:args) { %w(other args) } + let(:args) { %w[other args] } before do allow(instance.class).to receive(:find_by).with(id: instance.id) @@ -192,7 +192,7 @@ RSpec.describe ReactiveCaching, :use_clean_rails_memory_store_caching do end context 'with custom reactive_cache_worker_finder' do - let(:args) { %w(arg1 arg2) } + let(:args) { %w[arg1 arg2] } let(:instance) { custom_finder_cache_test.new(666, &calculation) } let(:custom_finder_cache_test) do diff --git a/spec/models/concerns/sortable_spec.rb b/spec/models/concerns/sortable_spec.rb index f1ae89f33af..98f4ab4f521 100644 --- a/spec/models/concerns/sortable_spec.rb +++ b/spec/models/concerns/sortable_spec.rb @@ -14,14 +14,14 @@ RSpec.describe Sortable do it 'allows secondary ordering by id ascending' do orders = arel_orders(sorted_relation.with_order_id_asc) - expect(orders.map { |arel| arel.expr.name }).to eq(%w(created_at id)) + expect(orders.map { |arel| arel.expr.name }).to eq(%w[created_at id]) expect(orders).to all(be_kind_of(Arel::Nodes::Ascending)) end it 'allows secondary ordering by id descending' do orders = arel_orders(sorted_relation.with_order_id_desc) - expect(orders.map { |arel| arel.expr.name }).to eq(%w(created_at id)) + expect(orders.map { |arel| arel.expr.name }).to eq(%w[created_at id]) expect(orders.first).to be_kind_of(Arel::Nodes::Ascending) expect(orders.last).to be_kind_of(Arel::Nodes::Descending) end @@ -123,24 +123,24 @@ RSpec.describe Sortable do let!(:group4) { create(:group, name: 'bbb', id: 4, created_at: ref_time, updated_at: ref_time - 15.seconds) } it 'sorts groups by id' do - expect(ordered_group_names('id_asc')).to eq(%w(aa AAA BB bbb)) - expect(ordered_group_names('id_desc')).to eq(%w(bbb BB AAA aa)) + expect(ordered_group_names('id_asc')).to eq(%w[aa AAA BB bbb]) + expect(ordered_group_names('id_desc')).to eq(%w[bbb BB AAA aa]) end it 'sorts groups by name via case-insensitive comparision' do - expect(ordered_group_names('name_asc')).to eq(%w(aa AAA BB bbb)) - expect(ordered_group_names('name_desc')).to eq(%w(bbb BB AAA aa)) + expect(ordered_group_names('name_asc')).to eq(%w[aa AAA BB bbb]) + expect(ordered_group_names('name_desc')).to eq(%w[bbb BB AAA aa]) end it 'sorts groups by created_at' do - expect(ordered_group_names('created_asc')).to eq(%w(aa AAA BB bbb)) - expect(ordered_group_names('created_desc')).to eq(%w(bbb BB AAA aa)) - expect(ordered_group_names('created_date')).to eq(%w(bbb BB AAA aa)) + expect(ordered_group_names('created_asc')).to eq(%w[aa AAA BB bbb]) + expect(ordered_group_names('created_desc')).to eq(%w[bbb BB AAA aa]) + expect(ordered_group_names('created_date')).to eq(%w[bbb BB AAA aa]) end it 'sorts groups by updated_at' do - expect(ordered_group_names('updated_asc')).to eq(%w(bbb BB AAA aa)) - expect(ordered_group_names('updated_desc')).to eq(%w(aa AAA BB bbb)) + expect(ordered_group_names('updated_asc')).to eq(%w[bbb BB AAA aa]) + expect(ordered_group_names('updated_desc')).to eq(%w[aa AAA BB bbb]) end end end diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 639b149e2ae..ee48e8cac6c 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -1336,7 +1336,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do let(:job_status) { :created } it_behaves_like 'gracefully handling error' do - let(:error_message) { %{Status cannot transition via \"create\"} } + let(:error_message) { %(Status cannot transition via \"create\") } end end @@ -1344,7 +1344,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do let(:job_status) { :manual } it_behaves_like 'gracefully handling error' do - let(:error_message) { %{Status cannot transition via \"block\"} } + let(:error_message) { %(Status cannot transition via \"block\") } end end @@ -1374,7 +1374,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do let(:job_status) { :created } it_behaves_like 'gracefully handling error' do - let(:error_message) { %{Status cannot transition via \"create\"} } + let(:error_message) { %(Status cannot transition via \"create\") } end end @@ -1382,7 +1382,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do let(:job_status) { :manual } it_behaves_like 'gracefully handling error' do - let(:error_message) { %{Status cannot transition via \"block\"} } + let(:error_message) { %(Status cannot transition via \"block\") } end end @@ -1390,7 +1390,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do let(:job_status) { :running } it_behaves_like 'gracefully handling error' do - let(:error_message) { %{Status cannot transition via \"run\"} } + let(:error_message) { %(Status cannot transition via \"run\") } end end diff --git a/spec/models/diff_viewer/base_spec.rb b/spec/models/diff_viewer/base_spec.rb index 57c62788ee9..8ab7b090928 100644 --- a/spec/models/diff_viewer/base_spec.rb +++ b/spec/models/diff_viewer/base_spec.rb @@ -13,7 +13,7 @@ RSpec.describe DiffViewer::Base do Class.new(described_class) do include DiffViewer::ServerSide - self.extensions = %w(jpg) + self.extensions = %w[jpg] self.binary = true self.collapse_limit = 1.megabyte self.size_limit = 5.megabytes @@ -55,7 +55,7 @@ RSpec.describe DiffViewer::Base do before do allow(diff_file).to receive(:renamed_file?).and_return(true) - viewer_class.extensions = %w(notjpg) + viewer_class.extensions = %w[notjpg] end it 'returns false' do diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index dcfee7fcc8c..9cf82c707f1 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -1361,7 +1361,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching, feature_categ end context 'reactive cache has pod data' do - let(:cache_data) { Hash(pods: %w(pod1 pod2)) } + let(:cache_data) { Hash(pods: %w[pod1 pod2]) } before do stub_reactive_cache(environment, cache_data) @@ -1390,9 +1390,9 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching, feature_categ it 'returns cache data from the deployment platform' do expect(environment.deployment_platform).to receive(:calculate_reactive_cache_for) - .with(environment).and_return(pods: %w(pod1 pod2)) + .with(environment).and_return(pods: %w[pod1 pod2]) - is_expected.to eq(pods: %w(pod1 pod2)) + is_expected.to eq(pods: %w[pod1 pod2]) end context 'environment does not have terminals available' do @@ -1863,8 +1863,8 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching, feature_categ end context 'cached rollout status is present' do - let(:pods) { %w(pod1 pod2) } - let(:deployments) { %w(deployment1 deployment2) } + let(:pods) { %w[pod1 pod2] } + let(:deployments) { %w[deployment1 deployment2] } before do stub_reactive_cache(environment, pods: pods, deployments: deployments) diff --git a/spec/models/group_label_spec.rb b/spec/models/group_label_spec.rb index 701348baf48..40019fdc94c 100644 --- a/spec/models/group_label_spec.rb +++ b/spec/models/group_label_spec.rb @@ -34,7 +34,7 @@ RSpec.describe GroupLabel do end it 'uses id when name contains double quote' do - label = create(:label, name: %q{"irony"}) + label = create(:label, name: %q("irony")) expect(label.to_reference(format: :name)).to eq "~#{label.id}" end end diff --git a/spec/models/instance_configuration_spec.rb b/spec/models/instance_configuration_spec.rb index 346f743e8ef..6fbb9245885 100644 --- a/spec/models/instance_configuration_spec.rb +++ b/spec/models/instance_configuration_spec.rb @@ -36,7 +36,7 @@ RSpec.describe InstanceConfiguration do result = subject.settings[:ssh_algorithms_hashes] - expect(result.map { |a| a[:name] }).to match_array(%w(DSA ECDSA ED25519 RSA)) + expect(result.map { |a| a[:name] }).to match_array(%w[DSA ECDSA ED25519 RSA]) end it 'does not include disabled algorithm' do @@ -45,7 +45,7 @@ RSpec.describe InstanceConfiguration do result = subject.settings[:ssh_algorithms_hashes] - expect(result.map { |a| a[:name] }).to match_array(%w(ECDSA ED25519 RSA)) + expect(result.map { |a| a[:name] }).to match_array(%w[ECDSA ED25519 RSA]) end def pub_file(exist: true) diff --git a/spec/models/integration_spec.rb b/spec/models/integration_spec.rb index 8396d5469ad..75f74f61bde 100644 --- a/spec/models/integration_spec.rb +++ b/spec/models/integration_spec.rb @@ -988,7 +988,7 @@ RSpec.describe Integration, feature_category: :integrations do subject { described_class.available_integration_names } before do - allow(described_class).to receive(:integration_names).and_return(%w(foo)) + allow(described_class).to receive(:integration_names).and_return(%w[foo]) allow(described_class).to receive(:project_specific_integration_names).and_return(['bar']) allow(described_class).to receive(:dev_integration_names).and_return(['baz']) end diff --git a/spec/models/integrations/buildkite_spec.rb b/spec/models/integrations/buildkite_spec.rb index f3231d50eae..ce31c0b20a3 100644 --- a/spec/models/integrations/buildkite_spec.rb +++ b/spec/models/integrations/buildkite_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Integrations::Buildkite, :use_clean_rails_memory_store_caching, f describe '.supported_events' do it 'supports push, merge_request, and tag_push events' do - expect(integration.supported_events).to eq %w(push merge_request tag_push) + expect(integration.supported_events).to eq %w[push merge_request tag_push] end end diff --git a/spec/models/integrations/campfire_spec.rb b/spec/models/integrations/campfire_spec.rb index 38d3d89cdbf..19f819252f8 100644 --- a/spec/models/integrations/campfire_spec.rb +++ b/spec/models/integrations/campfire_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Integrations::Campfire, feature_category: :integrations do ) @sample_data = Gitlab::DataBuilder::Push.build_sample(project, user) @rooms_url = 'https://project-name.campfirenow.com/rooms.json' - @auth = %w(verySecret X) + @auth = %w[verySecret X] @headers = { 'Content-Type' => 'application/json; charset=utf-8' } end diff --git a/spec/models/integrations/jira_spec.rb b/spec/models/integrations/jira_spec.rb index c87128db221..d3ae92ea52a 100644 --- a/spec/models/integrations/jira_spec.rb +++ b/spec/models/integrations/jira_spec.rb @@ -719,10 +719,10 @@ RSpec.describe Integrations::Jira, feature_category: :integrations do allow_any_instance_of(JIRA::Resource::Issue).to receive(:key).and_return(issue_key) allow(JIRA::Resource::Remotelink).to receive(:all).and_return([]) - WebMock.stub_request(:get, issue_url).with(basic_auth: %w(jira-username jira-password)) - WebMock.stub_request(:post, transitions_url).with(basic_auth: %w(jira-username jira-password)) - WebMock.stub_request(:post, comment_url).with(basic_auth: %w(jira-username jira-password)) - WebMock.stub_request(:post, remote_link_url).with(basic_auth: %w(jira-username jira-password)) + WebMock.stub_request(:get, issue_url).with(basic_auth: %w[jira-username jira-password]) + WebMock.stub_request(:post, transitions_url).with(basic_auth: %w[jira-username jira-password]) + WebMock.stub_request(:post, comment_url).with(basic_auth: %w[jira-username jira-password]) + WebMock.stub_request(:post, remote_link_url).with(basic_auth: %w[jira-username jira-password]) end let(:external_issue) { ExternalIssue.new('JIRA-123', project) } @@ -864,7 +864,7 @@ RSpec.describe Integrations::Jira, feature_category: :integrations do it 'logs exception when transition id is not valid' do allow(jira_integration).to receive(:log_exception) - WebMock.stub_request(:post, transitions_url).with(basic_auth: %w(jira-username jira-password)).and_raise("Bad Request") + WebMock.stub_request(:post, transitions_url).with(basic_auth: %w[jira-username jira-password]).and_raise("Bad Request") close_issue @@ -973,7 +973,7 @@ RSpec.describe Integrations::Jira, feature_category: :integrations do context 'when a transition fails' do before do - WebMock.stub_request(:post, transitions_url).with(basic_auth: %w(jira-username jira-password)).to_return do |request| + WebMock.stub_request(:post, transitions_url).with(basic_auth: %w[jira-username jira-password]).to_return do |request| { status: request.body.include?('"id":"2"') ? 500 : 200 } end end diff --git a/spec/models/integrations/teamcity_spec.rb b/spec/models/integrations/teamcity_spec.rb index c4c7202fae0..1537b10ba03 100644 --- a/spec/models/integrations/teamcity_spec.rb +++ b/spec/models/integrations/teamcity_spec.rb @@ -308,7 +308,7 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do def stub_post_to_build_queue(branch:) teamcity_full_url = "#{teamcity_url}/httpAuth/app/rest/buildQueue" body ||= %(<build branchName=\"#{branch}\"><buildType id=\"foo\"/></build>) - auth = %w(mic password) + auth = %w[mic password] stub_full_request(teamcity_full_url, method: :post).with( basic_auth: auth, @@ -320,7 +320,7 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do end def stub_request(status: 200, body: nil, build_status: 'success') - auth = %w(mic password) + auth = %w[mic password] body ||= %({"build":{"status":"#{build_status}","id":"666"}}) diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index e7a5a53c6a0..6c8603d7b4c 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -373,10 +373,10 @@ RSpec.describe Issue, feature_category: :team_planning do describe '.simple_sorts' do it 'includes all keys' do expect(described_class.simple_sorts.keys).to include( - *%w(created_asc created_at_asc created_date created_desc created_at_desc + *%w[created_asc created_at_asc created_date created_desc created_at_desc closest_future_date closest_future_date_asc due_date due_date_asc due_date_desc id_asc id_desc relative_position relative_position_asc updated_desc updated_asc - updated_at_asc updated_at_desc title_asc title_desc)) + updated_at_asc updated_at_desc title_asc title_desc]) end end @@ -390,7 +390,7 @@ RSpec.describe Issue, feature_category: :team_planning do end it 'returns issues with the given issue types' do - expect(described_class.with_issue_type(%w(issue incident))) + expect(described_class.with_issue_type(%w[issue incident])) .to contain_exactly(issue, incident) end @@ -439,7 +439,7 @@ RSpec.describe Issue, feature_category: :team_planning do end it 'returns issues without the given issue types' do - expect(described_class.without_issue_type(%w(issue incident))) + expect(described_class.without_issue_type(%w[issue incident])) .to contain_exactly(task) end diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb index 806ce3f21b5..bcab2029942 100644 --- a/spec/models/merge_request_diff_spec.rb +++ b/spec/models/merge_request_diff_spec.rb @@ -1090,7 +1090,7 @@ RSpec.describe MergeRequestDiff, feature_category: :code_review_workflow do end it 'returns affected file paths' do - expect(subject.modified_paths).to eq(%w{foo bar baz}) + expect(subject.modified_paths).to eq(%w[foo bar baz]) end context "when fallback_on_overflow is true" do diff --git a/spec/models/namespace_statistics_spec.rb b/spec/models/namespace_statistics_spec.rb index ac747b70a9f..ee3b4765dba 100644 --- a/spec/models/namespace_statistics_spec.rb +++ b/spec/models/namespace_statistics_spec.rb @@ -171,7 +171,7 @@ RSpec.describe NamespaceStatistics do context 'when other columns are updated' do it 'does not enqueue the job to update root storage statistics' do - columns_to_update = NamespaceStatistics.columns_hash.reject { |k, _| %w(id namespace_id).include?(k) || k.include?('_size') }.keys + columns_to_update = NamespaceStatistics.columns_hash.reject { |k, _| %w[id namespace_id].include?(k) || k.include?('_size') }.keys columns_to_update.each { |c| statistics[c] = 10 } expect(statistics).not_to receive(:update_root_storage_statistics) diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb index e113218e828..8e3b97e55f3 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -1196,7 +1196,7 @@ RSpec.describe Packages::Package, type: :model, feature_category: :package_regis it { is_expected.to eq([]) } context 'with tags' do - let(:tags) { %w(tag1 tag2 tag3) } + let(:tags) { %w[tag1 tag2 tag3] } before do tags.each { |t| create(:packages_tag, name: t, package: package) } diff --git a/spec/models/packages/tag_spec.rb b/spec/models/packages/tag_spec.rb index bc03c34f56b..8a6b88f966d 100644 --- a/spec/models/packages/tag_spec.rb +++ b/spec/models/packages/tag_spec.rb @@ -61,7 +61,7 @@ RSpec.describe Packages::Tag, type: :model, feature_category: :package_registry end context 'with multiple names' do - let(:name) { %w(tag1 tag3) } + let(:name) { %w[tag1 tag3] } it { is_expected.to contain_exactly(tag1, tag3) } end diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb index 5a4eca11f71..fae0b9d011c 100644 --- a/spec/models/pages_domain_spec.rb +++ b/spec/models/pages_domain_spec.rb @@ -84,20 +84,20 @@ RSpec.describe PagesDomain, feature_category: :pages do attributes = attributes_for(:pages_domain) cert, key = attributes.fetch_values(:certificate, :key) - true | nil | nil | false | %i(certificate key) + true | nil | nil | false | %i[certificate key] true | nil | nil | true | [] - true | cert | nil | false | %i(key) - true | cert | nil | true | %i(key) - true | nil | key | false | %i(certificate key) - true | nil | key | true | %i(key) + true | cert | nil | false | %i[key] + true | cert | nil | true | %i[key] + true | nil | key | false | %i[certificate key] + true | nil | key | true | %i[key] true | cert | key | false | [] true | cert | key | true | [] false | nil | nil | false | [] false | nil | nil | true | [] - false | cert | nil | false | %i(key) - false | cert | nil | true | %i(key) - false | nil | key | false | %i(key) - false | nil | key | true | %i(key) + false | cert | nil | false | %i[key] + false | cert | nil | true | %i[key] + false | nil | key | false | %i[key] + false | nil | key | true | %i[key] false | cert | key | false | [] false | cert | key | true | [] end diff --git a/spec/models/personal_access_token_spec.rb b/spec/models/personal_access_token_spec.rb index 7437e9b463e..7665f4dbde4 100644 --- a/spec/models/personal_access_token_spec.rb +++ b/spec/models/personal_access_token_spec.rb @@ -365,7 +365,7 @@ RSpec.describe PersonalAccessToken, feature_category: :system_access do describe '.simple_sorts' do it 'includes overridden keys' do - expect(described_class.simple_sorts.keys).to include(*%w(expires_at_asc_id_desc)) + expect(described_class.simple_sorts.keys).to include(*%w[expires_at_asc_id_desc]) end end diff --git a/spec/models/project_feature_spec.rb b/spec/models/project_feature_spec.rb index 39e77df1900..c0a78ff2f53 100644 --- a/spec/models/project_feature_spec.rb +++ b/spec/models/project_feature_spec.rb @@ -53,7 +53,7 @@ RSpec.describe ProjectFeature, feature_category: :groups_and_projects do end it "does not allow repository related features have higher level" do - features = %w(builds merge_requests) + features = %w[builds merge_requests] project_feature = project.project_feature features.each do |feature| @@ -64,7 +64,7 @@ RSpec.describe ProjectFeature, feature_category: :groups_and_projects do end end - it_behaves_like 'access level validation', ProjectFeature::FEATURES - %i(pages package_registry) do + it_behaves_like 'access level validation', ProjectFeature::FEATURES - %i[pages package_registry] do let(:container_features) { project.project_feature } end diff --git a/spec/models/project_label_spec.rb b/spec/models/project_label_spec.rb index 62839f5fb4f..01df58ee615 100644 --- a/spec/models/project_label_spec.rb +++ b/spec/models/project_label_spec.rb @@ -89,7 +89,7 @@ RSpec.describe ProjectLabel do end it 'uses id when name contains double quote' do - label = create(:label, name: %q{"irony"}) + label = create(:label, name: %q("irony")) expect(label.to_reference(format: :name)).to eq "~#{label.id}" end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d4e23823f23..5f1054a35bb 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1136,24 +1136,24 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr it { is_expected.to delegate_method(:npm_package_requests_forwarding).to(:namespace) } describe 'read project settings' do - %i( + %i[ show_default_award_emojis show_default_award_emojis? warn_about_potentially_unwanted_characters warn_about_potentially_unwanted_characters? enforce_auth_checks_on_uploads enforce_auth_checks_on_uploads? - ).each do |method| + ].each do |method| it { is_expected.to delegate_method(method).to(:project_setting).allow_nil } end end describe 'write project settings' do - %i( + %i[ show_default_award_emojis= warn_about_potentially_unwanted_characters= enforce_auth_checks_on_uploads= - ).each do |method| + ].each do |method| it { is_expected.to delegate_method(method).to(:project_setting).with_arguments(:args).allow_nil } end end @@ -1177,12 +1177,12 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr let(:exclude_attributes) do # Skip attributes defined in EE code - %w( + %w[ merge_pipelines_enabled merge_trains_enabled auto_rollback_enabled merge_trains_skip_train_allowed - ) + ] end end @@ -4287,7 +4287,7 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr end context 'when project has a deployment platform' do - let(:platform_variables) { %w(platform variables) } + let(:platform_variables) { %w[platform variables] } let(:deployment_platform) { double } before do diff --git a/spec/models/projects/topic_spec.rb b/spec/models/projects/topic_spec.rb index 568a4166de7..b3a55ccd370 100644 --- a/spec/models/projects/topic_spec.rb +++ b/spec/models/projects/topic_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Projects::Topic do describe '#find_by_name_case_insensitive' do it 'returns topic with case insensitive name' do - %w(topic TOPIC Topic).each do |name| + %w[topic TOPIC Topic].each do |name| expect(described_class.find_by_name_case_insensitive(name)).to eq(topic) end end diff --git a/spec/models/prometheus_metric_spec.rb b/spec/models/prometheus_metric_spec.rb index a20f4edcf4a..c8a95aef8a6 100644 --- a/spec/models/prometheus_metric_spec.rb +++ b/spec/models/prometheus_metric_spec.rb @@ -94,16 +94,16 @@ RSpec.describe PrometheusMetric do describe '#required_metrics' do where(:group, :required_metrics) do - :nginx_ingress_vts | %w(nginx_upstream_responses_total nginx_upstream_response_msecs_avg) - :nginx_ingress | %w(nginx_ingress_controller_requests nginx_ingress_controller_ingress_upstream_latency_seconds_sum) - :ha_proxy | %w(haproxy_frontend_http_requests_total haproxy_frontend_http_responses_total) - :aws_elb | %w(aws_elb_request_count_sum aws_elb_latency_average aws_elb_httpcode_backend_5_xx_sum) - :nginx | %w(nginx_server_requests nginx_server_requestMsec) - :kubernetes | %w(container_memory_usage_bytes container_cpu_usage_seconds_total) - :business | %w() - :response | %w() - :system | %w() - :cluster_health | %w(container_memory_usage_bytes container_cpu_usage_seconds_total) + :nginx_ingress_vts | %w[nginx_upstream_responses_total nginx_upstream_response_msecs_avg] + :nginx_ingress | %w[nginx_ingress_controller_requests nginx_ingress_controller_ingress_upstream_latency_seconds_sum] + :ha_proxy | %w[haproxy_frontend_http_requests_total haproxy_frontend_http_responses_total] + :aws_elb | %w[aws_elb_request_count_sum aws_elb_latency_average aws_elb_httpcode_backend_5_xx_sum] + :nginx | %w[nginx_server_requests nginx_server_requestMsec] + :kubernetes | %w[container_memory_usage_bytes container_cpu_usage_seconds_total] + :business | %w[] + :response | %w[] + :system | %w[] + :cluster_health | %w[container_memory_usage_bytes container_cpu_usage_seconds_total] end with_them do diff --git a/spec/models/releases/link_spec.rb b/spec/models/releases/link_spec.rb index c4c9fba32d9..5d264af695b 100644 --- a/spec/models/releases/link_spec.rb +++ b/spec/models/releases/link_spec.rb @@ -82,7 +82,7 @@ RSpec.describe Releases::Link do describe 'supported protocols' do where(:protocol) do - %w(http https ftp) + %w[http https ftp] end with_them do diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 5c766035e98..f81a198a27d 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -743,7 +743,7 @@ RSpec.describe Repository, feature_category: :source_code_management do describe "#merged_branch_names", :clean_gitlab_redis_cache do subject { repository.merged_branch_names(branch_names) } - let(:branch_names) { %w(test beep boop definitely_merged) } + let(:branch_names) { %w[test beep boop definitely_merged] } let(:already_merged) { Set.new(["definitely_merged"]) } let(:write_hash) do @@ -1621,16 +1621,16 @@ RSpec.describe Repository, feature_category: :source_code_management do where(:branch_names, :tag_names, :result) do nil | nil | false - %w() | %w() | false - %w(a b) | %w() | false - %w() | %w(c d) | false - %w(a b) | %w(c d) | false - %w(a/b) | %w(c/d) | false - %w(a b) | %w(c d a/z) | true - %w(a b c/z) | %w(c d) | true - %w(a/b/z) | %w(a/b) | false # we only consider refs ambiguous before the first slash - %w(a/b/z) | %w(a/b a) | true - %w(ab) | %w(abc/d a b) | false + %w[] | %w[] | false + %w[a b] | %w[] | false + %w[] | %w[c d] | false + %w[a b] | %w[c d] | false + %w[a/b] | %w[c/d] | false + %w[a b] | %w[c d a/z] | true + %w[a b c/z] | %w[c d] | true + %w[a/b/z] | %w[a/b] | false # we only consider refs ambiguous before the first slash + %w[a/b/z] | %w[a/b a] | true + %w[ab] | %w[abc/d a b] | false end with_them do @@ -2596,7 +2596,7 @@ RSpec.describe Repository, feature_category: :source_code_management do describe '#expire_branches_cache' do it 'expires the cache' do expect(repository).to receive(:expire_method_caches) - .with(%i(branch_names merged_branch_names branch_count has_visible_content? has_ambiguous_refs?)) + .with(%i[branch_names merged_branch_names branch_count has_visible_content? has_ambiguous_refs?]) .and_call_original expect_next_instance_of(ProtectedBranches::CacheService) do |cache_service| @@ -2630,7 +2630,7 @@ RSpec.describe Repository, feature_category: :source_code_management do describe '#expire_tags_cache' do it 'expires the cache' do expect(repository).to receive(:expire_method_caches) - .with(%i(tag_names tag_count has_ambiguous_refs?)) + .with(%i[tag_names tag_count has_ambiguous_refs?]) .and_call_original repository.expire_tags_cache @@ -2889,7 +2889,7 @@ RSpec.describe Repository, feature_category: :source_code_management do describe '#expire_statistics_caches' do it 'expires the caches' do expect(repository).to receive(:expire_method_caches) - .with(%i(size recent_objects_size commit_count)) + .with(%i[size recent_objects_size commit_count]) repository.expire_statistics_caches end @@ -3090,13 +3090,13 @@ RSpec.describe Repository, feature_category: :source_code_management do describe '#refresh_method_caches' do it 'refreshes the caches of the given types' do expect(repository).to receive(:expire_method_caches) - .with(%i(readme_path license_blob license_gitaly)) + .with(%i[readme_path license_blob license_gitaly]) expect(repository).to receive(:readme_path) expect(repository).to receive(:license_blob) expect(repository).to receive(:license_gitaly) - repository.refresh_method_caches(%i(readme license)) + repository.refresh_method_caches(%i[readme license]) end end diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index ec2dfb2634f..7eb1d9fda7b 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -614,7 +614,7 @@ RSpec.describe Snippet do context 'when file does not exist' do it 'removes nil values from the blobs array' do - allow(snippet).to receive(:list_files).and_return(%w(LICENSE non_existent_snippet_file)) + allow(snippet).to receive(:list_files).and_return(%w[LICENSE non_existent_snippet_file]) blobs = snippet.blobs expect(blobs.count).to eq 1 diff --git a/spec/models/terraform/state_spec.rb b/spec/models/terraform/state_spec.rb index fc0a6432149..df8051ebbc6 100644 --- a/spec/models/terraform/state_spec.rb +++ b/spec/models/terraform/state_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Terraform::State, feature_category: :infrastructure_as_code do describe '.ordered_by_name' do let_it_be(:project) { create(:project) } - let(:names) { %w(state_d state_b state_a state_c) } + let(:names) { %w[state_d state_b state_a state_c] } subject { described_class.ordered_by_name } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 09eb92e01e6..cff98cdb9fb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1280,7 +1280,7 @@ RSpec.describe User, feature_category: :user_profile do user = create(:user, username: 'CaMeLcAsEd') user2 = create(:user, username: 'UPPERCASE') - expect(described_class.by_username(%w(CAMELCASED uppercase))) + expect(described_class.by_username(%w[CAMELCASED uppercase])) .to contain_exactly(user, user2) end @@ -5833,37 +5833,37 @@ RSpec.describe User, feature_category: :user_profile do context 'oauth user' do it 'returns true if name can be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(name location)) + stub_omniauth_setting(sync_profile_attributes: %w[name location]) expect(user.sync_attribute?(:name)).to be_truthy end it 'returns true if email can be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(name email)) + stub_omniauth_setting(sync_profile_attributes: %w[name email]) expect(user.sync_attribute?(:email)).to be_truthy end it 'returns true if location can be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(location email)) + stub_omniauth_setting(sync_profile_attributes: %w[location email]) expect(user.sync_attribute?(:email)).to be_truthy end it 'returns false if name can not be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(location email)) + stub_omniauth_setting(sync_profile_attributes: %w[location email]) expect(user.sync_attribute?(:name)).to be_falsey end it 'returns false if email can not be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(location name)) + stub_omniauth_setting(sync_profile_attributes: %w[location name]) expect(user.sync_attribute?(:email)).to be_falsey end it 'returns false if location can not be synced' do - stub_omniauth_setting(sync_profile_attributes: %w(name email)) + stub_omniauth_setting(sync_profile_attributes: %w[name email]) expect(user.sync_attribute?(:location)).to be_falsey end @@ -5894,7 +5894,7 @@ RSpec.describe User, feature_category: :user_profile do it 'returns true for email and location if ldap user and location declared as syncable' do allow(user).to receive(:ldap_user?).and_return(true) - stub_omniauth_setting(sync_profile_attributes: %w(location)) + stub_omniauth_setting(sync_profile_attributes: %w[location]) expect(user.sync_attribute?(:name)).to be_falsey expect(user.sync_attribute?(:email)).to be_truthy diff --git a/spec/models/web_ide_terminal_spec.rb b/spec/models/web_ide_terminal_spec.rb index fc30bc18f68..505b7531db4 100644 --- a/spec/models/web_ide_terminal_spec.rb +++ b/spec/models/web_ide_terminal_spec.rb @@ -45,7 +45,7 @@ RSpec.describe WebIdeTerminal do end it 'returns services aliases' do - expect(subject.services).to eq %w(postgres docker) + expect(subject.services).to eq %w[postgres docker] end end @@ -55,7 +55,7 @@ RSpec.describe WebIdeTerminal do end it 'returns all aliases' do - expect(subject.services).to eq %w(postgres docker ruby) + expect(subject.services).to eq %w[postgres docker ruby] end end @@ -71,7 +71,7 @@ RSpec.describe WebIdeTerminal do context 'when no image nor services' do let(:config) do - { script: %w(echo) } + { script: %w[echo] } end it 'returns an empty array' do diff --git a/spec/models/zoom_meeting_spec.rb b/spec/models/zoom_meeting_spec.rb index d3d75a19fed..b67a9d4a2ff 100644 --- a/spec/models/zoom_meeting_spec.rb +++ b/spec/models/zoom_meeting_spec.rb @@ -65,7 +65,7 @@ RSpec.describe ZoomMeeting do context 'with non-Zoom URL' do before do - subject.url = %{https://non-zoom.url} + subject.url = %(https://non-zoom.url) end include_examples 'invalid Zoom URL' @@ -73,7 +73,7 @@ RSpec.describe ZoomMeeting do context 'with multiple Zoom-URLs' do before do - subject.url = %{https://zoom.us/j/123 https://zoom.us/j/456} + subject.url = %(https://zoom.us/j/123 https://zoom.us/j/456) end include_examples 'invalid Zoom URL' |