From d62f92231fd9ac1faf89a87cebb421d5b31f6ea7 Mon Sep 17 00:00:00 2001 From: David Kim <dkim@gitlab.com> Date: Fri, 30 Jun 2023 16:23:07 +0930 Subject: [PATCH] Fix another Rspec/DescribedClass violations Fixed it by running rubocop with the autocorrect option --- .rubocop_todo/rspec/described_class.yml | 46 ------------------- .../concerns/elastic/merge_request_spec.rb | 2 +- ee/spec/models/concerns/elastic/note_spec.rb | 10 ++-- .../models/concerns/elastic/project_spec.rb | 2 +- .../concerns/elastic/repository_spec.rb | 6 +-- ee/spec/models/dast_scanner_profile_spec.rb | 4 +- ee/spec/models/dast_site_profile_spec.rb | 2 +- ee/spec/models/ee/ci/job_artifact_spec.rb | 6 +-- ee/spec/models/ee/ci/pending_build_spec.rb | 4 +- ee/spec/models/ee/ci/runner_spec.rb | 2 +- ee/spec/models/ee/gpg_key_spec.rb | 2 +- ee/spec/models/ee/group_spec.rb | 8 ++-- ee/spec/models/ee/project_spec.rb | 6 +-- ee/spec/models/ee/vulnerability_spec.rb | 4 +- ee/spec/models/epic_issue_spec.rb | 2 +- ee/spec/models/epic_spec.rb | 2 +- .../geo/container_repository_registry_spec.rb | 6 +-- ee/spec/models/geo/design_registry_spec.rb | 2 +- .../models/geo/package_file_registry_spec.rb | 2 +- ee/spec/models/geo/project_registry_spec.rb | 2 +- .../models/geo/secondary_usage_data_spec.rb | 2 +- ee/spec/models/issuable_metric_image_spec.rb | 2 +- ee/spec/models/issue_spec.rb | 14 +++--- ee/spec/models/iteration_spec.rb | 4 +- ee/spec/models/license_spec.rb | 36 +++++++-------- ee/spec/models/project_import_state_spec.rb | 2 +- ee/spec/models/release_highlight_spec.rb | 2 +- .../test_report_spec.rb | 6 +-- ee/spec/models/resource_weight_event_spec.rb | 8 ++-- ee/spec/models/uploads/local_spec.rb | 2 +- ee/spec/models/vulnerabilities/flag_spec.rb | 2 +- .../blocked_users_report_service_spec.rb | 2 +- ...hetic_weight_notes_builder_service_spec.rb | 2 +- .../services/ee/users/reject_service_spec.rb | 2 +- .../tasks/update_vulnerability_uuids_spec.rb | 2 +- .../users/captcha_challenge_service_spec.rb | 4 +- .../concerns/elastic/indexing_control_spec.rb | 6 +-- .../registry_consistency_worker_spec.rb | 4 +- ...verification_state_backfill_worker_spec.rb | 4 +- spec/config/settings_spec.rb | 4 +- .../repositories/git_http_controller_spec.rb | 10 ++-- .../application_experiment_spec.rb | 2 +- spec/frontend/fixtures/timezones.rb | 2 +- spec/graphql/gitlab_schema_spec.rb | 2 +- spec/graphql/graphql_triggers_spec.rb | 22 ++++----- spec/graphql/types/global_id_type_spec.rb | 6 +-- spec/initializers/google_api_client_spec.rb | 2 +- 47 files changed, 115 insertions(+), 161 deletions(-) diff --git a/.rubocop_todo/rspec/described_class.yml b/.rubocop_todo/rspec/described_class.yml index 511f47549ee51..5868749048adc 100644 --- a/.rubocop_todo/rspec/described_class.yml +++ b/.rubocop_todo/rspec/described_class.yml @@ -2,55 +2,9 @@ # Cop supports --autocorrect. RSpec/DescribedClass: Exclude: - - 'ee/spec/models/concerns/elastic/merge_request_spec.rb' - - 'ee/spec/models/concerns/elastic/note_spec.rb' - - 'ee/spec/models/concerns/elastic/project_spec.rb' - - 'ee/spec/models/concerns/elastic/repository_spec.rb' - - 'ee/spec/models/dast_scanner_profile_spec.rb' - - 'ee/spec/models/dast_site_profile_spec.rb' - - 'ee/spec/models/ee/ci/job_artifact_spec.rb' - - 'ee/spec/models/ee/ci/pending_build_spec.rb' - - 'ee/spec/models/ee/ci/runner_spec.rb' - - 'ee/spec/models/ee/gpg_key_spec.rb' - - 'ee/spec/models/ee/group_spec.rb' - - 'ee/spec/models/ee/project_spec.rb' - - 'ee/spec/models/ee/vulnerability_spec.rb' - - 'ee/spec/models/epic_issue_spec.rb' - - 'ee/spec/models/epic_spec.rb' - - 'ee/spec/models/geo/container_repository_registry_spec.rb' - - 'ee/spec/models/geo/design_registry_spec.rb' - - 'ee/spec/models/geo/package_file_registry_spec.rb' - - 'ee/spec/models/geo/project_registry_spec.rb' - - 'ee/spec/models/geo/secondary_usage_data_spec.rb' - - 'ee/spec/models/issuable_metric_image_spec.rb' - - 'ee/spec/models/issue_spec.rb' - - 'ee/spec/models/iteration_spec.rb' - - 'ee/spec/models/license_spec.rb' - - 'ee/spec/models/project_import_state_spec.rb' - - 'ee/spec/models/release_highlight_spec.rb' - - 'ee/spec/models/requirements_management/test_report_spec.rb' - - 'ee/spec/models/resource_weight_event_spec.rb' - - 'ee/spec/models/uploads/local_spec.rb' - - 'ee/spec/models/vulnerabilities/flag_spec.rb' - - 'ee/spec/services/arkose/blocked_users_report_service_spec.rb' - - 'ee/spec/services/ee/resource_events/synthetic_weight_notes_builder_service_spec.rb' - - 'ee/spec/services/ee/users/reject_service_spec.rb' - - 'ee/spec/services/security/ingestion/tasks/update_vulnerability_uuids_spec.rb' - - 'ee/spec/services/users/captcha_challenge_service_spec.rb' - - 'ee/spec/workers/concerns/elastic/indexing_control_spec.rb' - - 'ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb' - - 'ee/spec/workers/geo/verification_state_backfill_worker_spec.rb' - 'qa/spec/service/docker_run/base_spec.rb' - 'qa/spec/support/loglinking_spec.rb' - 'qa/spec/support/page_error_checker_spec.rb' - - 'spec/config/settings_spec.rb' - - 'spec/controllers/repositories/git_http_controller_spec.rb' - - 'spec/experiments/application_experiment_spec.rb' - - 'spec/frontend/fixtures/timezones.rb' - - 'spec/graphql/gitlab_schema_spec.rb' - - 'spec/graphql/graphql_triggers_spec.rb' - - 'spec/graphql/types/global_id_type_spec.rb' - - 'spec/initializers/google_api_client_spec.rb' - 'spec/lib/feature_spec.rb' - 'spec/lib/gitlab/ci/variables/collection/item_spec.rb' - 'spec/lib/gitlab/git/repository_spec.rb' diff --git a/ee/spec/models/concerns/elastic/merge_request_spec.rb b/ee/spec/models/concerns/elastic/merge_request_spec.rb index 3af9e515fd180..19c7f745deb02 100644 --- a/ee/spec/models/concerns/elastic/merge_request_spec.rb +++ b/ee/spec/models/concerns/elastic/merge_request_spec.rb @@ -35,7 +35,7 @@ options = { project_ids: [project.id] } expect(described_class.elastic_search('term1 | term2 | term3', options: options).total_count).to eq(2) - expect(described_class.elastic_search(MergeRequest.last.to_reference, options: options).total_count).to eq(1) + expect(described_class.elastic_search(described_class.last.to_reference, options: options).total_count).to eq(1) expect(described_class.elastic_search('term3', options: options).total_count).to eq(0) expect(described_class.elastic_search('term3', options: { project_ids: :any, public_and_internal_projects: true }).total_count).to eq(1) end diff --git a/ee/spec/models/concerns/elastic/note_spec.rb b/ee/spec/models/concerns/elastic/note_spec.rb index b701f533ba89d..c6a61139cf078 100644 --- a/ee/spec/models/concerns/elastic/note_spec.rb +++ b/ee/spec/models/concerns/elastic/note_spec.rb @@ -211,7 +211,7 @@ options = { project_ids: [issue.project.id] } - expect(Note.elastic_search('term', options: options).total_count).to eq(0) + expect(described_class.elastic_search('term', options: options).total_count).to eq(0) end it "finds note when user is authorized to see it", :sidekiq_might_not_need_inline do @@ -226,7 +226,7 @@ options = { project_ids: [issue.project.id], current_user: user } - expect(Note.elastic_search('term', options: options).total_count).to eq(1) + expect(described_class.elastic_search('term', options: options).total_count).to eq(1) end shared_examples 'notes finder' do |user_type, no_of_notes| @@ -241,7 +241,7 @@ options = { project_ids: [issue.project.id], current_user: superuser } - expect(Note.elastic_search('term', options: options).total_count).to eq(no_of_notes) + expect(described_class.elastic_search('term', options: options).total_count).to eq(no_of_notes) end end @@ -267,7 +267,7 @@ options = { project_ids: [issue.project.id], current_user: member } - expect(Note.elastic_search('term', options: options).total_count).to eq(1) + expect(described_class.elastic_search('term', options: options).total_count).to eq(1) end it "does not return notes with matching content for project members with guest role" do @@ -284,7 +284,7 @@ options = { project_ids: [issue.project.id], current_user: member } - expect(Note.elastic_search('term', options: options).total_count).to eq(0) + expect(described_class.elastic_search('term', options: options).total_count).to eq(0) end end diff --git a/ee/spec/models/concerns/elastic/project_spec.rb b/ee/spec/models/concerns/elastic/project_spec.rb index 70ef7140f2aaa..66c5e20c8fe91 100644 --- a/ee/spec/models/concerns/elastic/project_spec.rb +++ b/ee/spec/models/concerns/elastic/project_spec.rb @@ -155,7 +155,7 @@ response = described_class.elastic_search('*') expect(response.total_count).to eq(1) - expect(response.results.first['_source']['type']).to eq(Project.es_type) + expect(response.results.first['_source']['type']).to eq(described_class.es_type) end end end diff --git a/ee/spec/models/concerns/elastic/repository_spec.rb b/ee/spec/models/concerns/elastic/repository_spec.rb index ee096ff77d76e..2f8ab6c74cdad 100644 --- a/ee/spec/models/concerns/elastic/repository_spec.rb +++ b/ee/spec/models/concerns/elastic/repository_spec.rb @@ -119,8 +119,8 @@ def search_and_check!(on, query, type:, per: 1000) project = create :project, :repository index!(project) - search_and_check!(Repository, '-foo', type: 'blob') - search_and_check!(Repository, '-foo', type: 'commit') + search_and_check!(described_class, '-foo', type: 'blob') + search_and_check!(described_class, '-foo', type: 'commit') search_and_check!(project.repository, '-foo', type: 'blob') search_and_check!(project.repository, '-foo', type: 'commit') end @@ -128,7 +128,7 @@ def search_and_check!(on, query, type:, per: 1000) describe 'class method find_commits_by_message_with_elastic', :sidekiq_might_not_need_inline do let(:project) { create :project, :repository } let(:project1) { create :project, :repository } - let(:results) { Repository.find_commits_by_message_with_elastic('initial') } + let(:results) { described_class.find_commits_by_message_with_elastic('initial') } before do project.repository.index_commits_and_blobs diff --git a/ee/spec/models/dast_scanner_profile_spec.rb b/ee/spec/models/dast_scanner_profile_spec.rb index a721d9bc146eb..011160fbcec54 100644 --- a/ee/spec/models/dast_scanner_profile_spec.rb +++ b/ee/spec/models/dast_scanner_profile_spec.rb @@ -22,14 +22,14 @@ describe 'scopes' do describe '.project_id_in' do it 'returns the dast_scanner_profiles for given projects' do - result = DastScannerProfile.project_id_in([subject.project.id]) + result = described_class.project_id_in([subject.project.id]) expect(result).to eq([subject]) end end describe '.with_name' do it 'returns the dast_scanner_profiles with given name' do - result = DastScannerProfile.with_name(subject.name) + result = described_class.with_name(subject.name) expect(result).to eq([subject]) end end diff --git a/ee/spec/models/dast_site_profile_spec.rb b/ee/spec/models/dast_site_profile_spec.rb index d313d2acc2ad8..7e5d20fc2987f 100644 --- a/ee/spec/models/dast_site_profile_spec.rb +++ b/ee/spec/models/dast_site_profile_spec.rb @@ -212,7 +212,7 @@ describe '.with_name' do it 'returns the dast_site_profiles with given name' do - result = DastSiteProfile.with_name(subject.name) + result = described_class.with_name(subject.name) expect(result).to eq([subject]) end end diff --git a/ee/spec/models/ee/ci/job_artifact_spec.rb b/ee/spec/models/ee/ci/job_artifact_spec.rb index de0e685c94a3b..01e72bebe76a0 100644 --- a/ee/spec/models/ee/ci/job_artifact_spec.rb +++ b/ee/spec/models/ee/ci/job_artifact_spec.rb @@ -186,7 +186,7 @@ context 'when the `file_types` parameter is provided' do let!(:sast_artifact) { create(:ee_ci_job_artifact, :sast) } - subject { Ci::JobArtifact.security_reports(file_types: file_types) } + subject { described_class.security_reports(file_types: file_types) } context 'when the provided file_types is array' do let(:file_types) { %w(secret_detection) } @@ -211,7 +211,7 @@ end context 'when the file_types parameter is not provided' do - subject { Ci::JobArtifact.security_reports } + subject { described_class.security_reports } context 'when there is a security report' do let!(:sast_artifact) { create(:ee_ci_job_artifact, :sast) } @@ -231,7 +231,7 @@ describe '.associated_file_types_for' do using RSpec::Parameterized::TableSyntax - subject { Ci::JobArtifact.associated_file_types_for(file_type) } + subject { described_class.associated_file_types_for(file_type) } where(:file_type, :result) do 'license_scanning' | %w(license_scanning) diff --git a/ee/spec/models/ee/ci/pending_build_spec.rb b/ee/spec/models/ee/ci/pending_build_spec.rb index 8db2e49c9009f..d79cbec59e86d 100644 --- a/ee/spec/models/ee/ci/pending_build_spec.rb +++ b/ee/spec/models/ee/ci/pending_build_spec.rb @@ -33,7 +33,7 @@ describe '.upsert_from_build!' do shared_examples 'ci minutes not available' do it 'sets minutes_exceeded to true' do - expect { described_class.upsert_from_build!(build) }.to change(Ci::PendingBuild, :count).by(1) + expect { described_class.upsert_from_build!(build) }.to change(described_class, :count).by(1) expect(described_class.last.minutes_exceeded).to be_truthy end @@ -41,7 +41,7 @@ shared_examples 'ci minutes available' do it 'sets minutes_exceeded to false' do - expect { described_class.upsert_from_build!(build) }.to change(Ci::PendingBuild, :count).by(1) + expect { described_class.upsert_from_build!(build) }.to change(described_class, :count).by(1) expect(described_class.last.minutes_exceeded).to be_falsey end diff --git a/ee/spec/models/ee/ci/runner_spec.rb b/ee/spec/models/ee/ci/runner_spec.rb index 51b734c49455a..f4688d247855d 100644 --- a/ee/spec/models/ee/ci/runner_spec.rb +++ b/ee/spec/models/ee/ci/runner_spec.rb @@ -119,7 +119,7 @@ end describe '.any_shared_runners_with_enabled_cost_factor' do - subject(:runners) { Ci::Runner.any_shared_runners_with_enabled_cost_factor?(project) } + subject(:runners) { described_class.any_shared_runners_with_enabled_cost_factor?(project) } let_it_be(:namespace) { create(:group) } diff --git a/ee/spec/models/ee/gpg_key_spec.rb b/ee/spec/models/ee/gpg_key_spec.rb index b182e44bdd3e4..66ca349331142 100644 --- a/ee/spec/models/ee/gpg_key_spec.rb +++ b/ee/spec/models/ee/gpg_key_spec.rb @@ -8,7 +8,7 @@ let_it_be(:user) { gpg_key.user } describe '.for_user' do - subject { GpgKey.for_user(user) } + subject { described_class.for_user(user) } it { is_expected.to contain_exactly(gpg_key) } end diff --git a/ee/spec/models/ee/group_spec.rb b/ee/spec/models/ee/group_spec.rb index 0d043917f06c4..44842d083f406 100644 --- a/ee/spec/models/ee/group_spec.rb +++ b/ee/spec/models/ee/group_spec.rb @@ -396,14 +396,14 @@ let(:groups) { [] } it 'does not use filter optimization' do - expect(Group).not_to receive(:filter_groups_user_can) + expect(described_class).not_to receive(:filter_groups_user_can) expect(subject).to be_empty end end it 'uses filter optmization to return groups with access' do - expect(Group).not_to receive(:filter_groups_user_can) + expect(described_class).not_to receive(:filter_groups_user_can) expect(subject).to match_array(expected_groups) end @@ -414,7 +414,7 @@ end it 'does not use filter optimization' do - expect(Group).not_to receive(:filter_groups_user_can) + expect(described_class).not_to receive(:filter_groups_user_can) expect(subject).to match_array(expected_groups) end end @@ -423,7 +423,7 @@ let(:params) { { same_root: false } } it 'does not use filter optimization' do - expect(Group).not_to receive(:filter_groups_user_can) + expect(described_class).not_to receive(:filter_groups_user_can) expect(subject).to match_array(expected_groups) end diff --git a/ee/spec/models/ee/project_spec.rb b/ee/spec/models/ee/project_spec.rb index 56bac1abacc34..03fa9fd924e45 100644 --- a/ee/spec/models/ee/project_spec.rb +++ b/ee/spec/models/ee/project_spec.rb @@ -1384,7 +1384,7 @@ let(:group) { nil } context 'when project has no group' do - let(:project) { Project.new } + let(:project) { described_class.new } it 'is false' do expect(project).not_to be_membership_locked @@ -4255,13 +4255,13 @@ def stub_default_url_options(host) describe 'deprecated requirements_enabled attribute' do it 'delegates the attribute to project feature' do - project = Project.new(requirements_enabled: false) + project = described_class.new(requirements_enabled: false) expect(project.project_feature.requirements_access_level).to eq(ProjectFeature::DISABLED) end it 'sets the default value' do - project = Project.new + project = described_class.new expect(project.project_feature.requirements_access_level).to eq(ProjectFeature::ENABLED) end diff --git a/ee/spec/models/ee/vulnerability_spec.rb b/ee/spec/models/ee/vulnerability_spec.rb index caf8a2adf05df..7e8d17c9f7128 100644 --- a/ee/spec/models/ee/vulnerability_spec.rb +++ b/ee/spec/models/ee/vulnerability_spec.rb @@ -920,13 +920,13 @@ it 'raises an error when an unknown sort direction given' do expect do - described_class.with_keyset_order(Vulnerability.state_order, 'state_order', unknown_sort_direction) + described_class.with_keyset_order(described_class.state_order, 'state_order', unknown_sort_direction) end.to raise_error("unknown sort direction given: abc") end it 'raises an error when an unknown sort direction given for tie breaking column' do expect do - described_class.with_keyset_order(Vulnerability.state_order, 'state_order', :asc, unknown_sort_direction) + described_class.with_keyset_order(described_class.state_order, 'state_order', :asc, unknown_sort_direction) end.to raise_error("unknown tie breaker sort direction given: abc") end end diff --git a/ee/spec/models/epic_issue_spec.rb b/ee/spec/models/epic_issue_spec.rb index a17538cabb5f5..81c02c7d421ed 100644 --- a/ee/spec/models/epic_issue_spec.rb +++ b/ee/spec/models/epic_issue_spec.rb @@ -102,7 +102,7 @@ def as_item(item) level = [nested, *leaves, right] expect do - EpicIssue.move_nulls_to_end(level) + described_class.move_nulls_to_end(level) end.not_to change { right.reset.relative_position } moved.each(&:reset) diff --git a/ee/spec/models/epic_spec.rb b/ee/spec/models/epic_spec.rb index 6f46842ee58fd..8768e2f1f1d68 100644 --- a/ee/spec/models/epic_spec.rb +++ b/ee/spec/models/epic_spec.rb @@ -127,7 +127,7 @@ end describe 'from_id' do - let_it_be(:max_id) { Epic.maximum(:id) } + let_it_be(:max_id) { described_class.maximum(:id) } let_it_be(:epic1) { create(:epic, id: max_id + 1) } let_it_be(:epic2) { create(:epic, id: max_id + 2) } let_it_be(:epic3) { create(:epic, id: max_id + 3) } diff --git a/ee/spec/models/geo/container_repository_registry_spec.rb b/ee/spec/models/geo/container_repository_registry_spec.rb index faca9b8c983ff..07c829d130377 100644 --- a/ee/spec/models/geo/container_repository_registry_spec.rb +++ b/ee/spec/models/geo/container_repository_registry_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Geo::ContainerRepositoryRegistry, :geo, feature_category: :geo_replication do include ::EE::GeoHelpers - it_behaves_like 'a BulkInsertSafe model', Geo::ContainerRepositoryRegistry do + it_behaves_like 'a BulkInsertSafe model', described_class do let(:valid_items_for_bulk_insertion) { build_list(:geo_container_repository_registry, 10, :with_repository_id, created_at: Time.zone.now) } let(:invalid_items_for_bulk_insertion) { [] } # class does not have any validations defined end @@ -195,13 +195,13 @@ it 'returns true when registry replication is enabled' do stub_geo_setting(registry_replication: { enabled: true }) - expect(Geo::ContainerRepositoryRegistry.replication_enabled?).to be_truthy + expect(described_class.replication_enabled?).to be_truthy end it 'returns false when registry replication is disabled' do stub_geo_setting(registry_replication: { enabled: false }) - expect(Geo::ContainerRepositoryRegistry.replication_enabled?).to be_falsey + expect(described_class.replication_enabled?).to be_falsey end end diff --git a/ee/spec/models/geo/design_registry_spec.rb b/ee/spec/models/geo/design_registry_spec.rb index 141f35e407962..c4259cae3d094 100644 --- a/ee/spec/models/geo/design_registry_spec.rb +++ b/ee/spec/models/geo/design_registry_spec.rb @@ -6,7 +6,7 @@ include ::EE::GeoHelpers using RSpec::Parameterized::TableSyntax - it_behaves_like 'a BulkInsertSafe model', Geo::DesignRegistry do + it_behaves_like 'a BulkInsertSafe model', described_class do let(:valid_items_for_bulk_insertion) do build_list(:geo_design_registry, 10, created_at: Time.zone.now) do |registry| registry.project = create(:project) diff --git a/ee/spec/models/geo/package_file_registry_spec.rb b/ee/spec/models/geo/package_file_registry_spec.rb index bfb333cf182fb..318f6cb9edb51 100644 --- a/ee/spec/models/geo/package_file_registry_spec.rb +++ b/ee/spec/models/geo/package_file_registry_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Geo::PackageFileRegistry, :geo, type: :model, feature_category: :geo_replication do include ::EE::GeoHelpers - it_behaves_like 'a BulkInsertSafe model', Geo::PackageFileRegistry do + it_behaves_like 'a BulkInsertSafe model', described_class do let(:valid_items_for_bulk_insertion) { build_list(:geo_package_file_registry, 10, package_file: create(:package_file, :npm), created_at: Time.zone.now) } let(:invalid_items_for_bulk_insertion) { [] } # class does not have any validations defined end diff --git a/ee/spec/models/geo/project_registry_spec.rb b/ee/spec/models/geo/project_registry_spec.rb index 2affdaeb4c386..421f21f7bb6d1 100644 --- a/ee/spec/models/geo/project_registry_spec.rb +++ b/ee/spec/models/geo/project_registry_spec.rb @@ -10,7 +10,7 @@ subject { registry } - it_behaves_like 'a BulkInsertSafe model', Geo::ProjectRegistry do + it_behaves_like 'a BulkInsertSafe model', described_class do let(:valid_items_for_bulk_insertion) do build_list(:geo_project_registry, 10, created_at: Time.zone.now) do |registry| registry.project = create(:project) diff --git a/ee/spec/models/geo/secondary_usage_data_spec.rb b/ee/spec/models/geo/secondary_usage_data_spec.rb index 8de42ac1fe5e5..e0a41ce41ad7f 100644 --- a/ee/spec/models/geo/secondary_usage_data_spec.rb +++ b/ee/spec/models/geo/secondary_usage_data_spec.rb @@ -44,7 +44,7 @@ end describe '#update_metrics!' do - let(:new_data) { double(Geo::SecondaryUsageData) } + let(:new_data) { double(described_class) } before do allow_next_instance_of(described_class) do |instance| diff --git a/ee/spec/models/issuable_metric_image_spec.rb b/ee/spec/models/issuable_metric_image_spec.rb index d850ea8f78ba7..681781c99ac5f 100644 --- a/ee/spec/models/issuable_metric_image_spec.rb +++ b/ee/spec/models/issuable_metric_image_spec.rb @@ -41,7 +41,7 @@ end describe '.available_for?' do - subject { IssuableMetricImage.available_for?(issue.project) } + subject { described_class.available_for?(issue.project) } before do stub_licensed_features(incident_metric_upload: true) diff --git a/ee/spec/models/issue_spec.rb b/ee/spec/models/issue_spec.rb index 0261b0f9ca560..e70ae37973c37 100644 --- a/ee/spec/models/issue_spec.rb +++ b/ee/spec/models/issue_spec.rb @@ -109,13 +109,13 @@ # there should be no way to update a requirement to issue type, doing this to test the scope issue4.save!(validate: false) - requirement_issues = Issue.for_requirement_iids(iids) + requirement_issues = described_class.for_requirement_iids(iids) expect(requirement_issues).to match_array([requirement1.requirement_issue, requirement3.requirement_issue]) end it 'uses work_item_type_id to filter requirements' do - expect { Issue.for_requirement_iids(iids).to_a }.to make_queries_matching( + expect { described_class.for_requirement_iids(iids).to_a }.to make_queries_matching( /"work_item_types"\."base_type" = #{WorkItems::Type.base_types[:requirement]}/ ) end @@ -129,15 +129,15 @@ let_it_be(:confidential_issue) { create(:issue, :published, :confidential, project: project) } let_it_be(:nonpublished_issue) { create(:issue, project: project) } - it { expect(Issue.on_status_page.count).to eq(1) } - it { expect(Issue.on_status_page.first).to eq(published_issue) } + it { expect(described_class.on_status_page.count).to eq(1) } + it { expect(described_class.on_status_page.first).to eq(published_issue) } context 'with status page disabled' do before do status_page_setting.update!(enabled: false) end - it { expect(Issue.on_status_page.count).to eq(0) } + it { expect(described_class.on_status_page.count).to eq(0) } end end @@ -458,7 +458,7 @@ describe '.simple_sorts' do it 'includes weight with other base keys' do - expect(Issue.simple_sorts.keys).to match_array( + expect(described_class.simple_sorts.keys).to match_array( %w(closest_future_date closest_future_date_asc created_asc created_at_asc created_at_desc created_date created_desc due_date due_date_asc due_date_desc id_asc id_desc relative_position @@ -642,7 +642,7 @@ describe '.relative_positioning_query_base' do it 'includes cross project issues in the same group' do - siblings = Issue.relative_positioning_query_base(issue) + siblings = described_class.relative_positioning_query_base(issue) expect(siblings).to include(issue1) end diff --git a/ee/spec/models/iteration_spec.rb b/ee/spec/models/iteration_spec.rb index e2ec996ca3dec..818e65a566ee4 100644 --- a/ee/spec/models/iteration_spec.rb +++ b/ee/spec/models/iteration_spec.rb @@ -112,7 +112,7 @@ shared_examples_for 'filter_by_state' do it 'filters by the given state' do - expect(described_class.filter_by_state(Iteration.all, state)).to match(expected_iterations) + expect(described_class.filter_by_state(described_class.all, state)).to match(expected_iterations) end end @@ -154,7 +154,7 @@ context 'filtering by nonexistent filter' do it 'returns no results' do expect do - described_class.filter_by_state(Iteration.all, 'unknown') + described_class.filter_by_state(described_class.all, 'unknown') end.to raise_error(ArgumentError, "Unknown state filter: unknown") end end diff --git a/ee/spec/models/license_spec.rb b/ee/spec/models/license_spec.rb index e443b3630d5ce..7574d14999f91 100644 --- a/ee/spec/models/license_spec.rb +++ b/ee/spec/models/license_spec.rb @@ -187,7 +187,7 @@ subject(:new_license) { build(:license, cloud: true, data: new_gl_license.export) } before do - allow(License).to receive(:current).and_return(current_license) + allow(described_class).to receive(:current).and_return(current_license) end context 'when the new license is a cloud license' do @@ -220,7 +220,7 @@ context 'when there is no current license' do before do - allow(License).to receive(:current).and_return(nil) + allow(described_class).to receive(:current).and_return(nil) end it 'validates for true-ups' do @@ -431,7 +431,7 @@ def create_historical_data(recorded_at, prior_active_user_count) before do create_list(:user, billable_users_count) - create_historical_data(License.current.expires_at, prior_active_user_count) + create_historical_data(described_class.current.expires_at, prior_active_user_count) end context 'with previous user count' do @@ -456,7 +456,7 @@ def create_historical_data(recorded_at, prior_active_user_count) before do create_list(:user, billable_users_count) - allow(License).to receive(:current).and_return(nil) + allow(described_class).to receive(:current).and_return(nil) end context 'when new license has an expiration date' do @@ -558,7 +558,7 @@ def current_license_cached_value end before do - License.current # Set cache up front + described_class.current # Set cache up front end context 'when a license is created' do @@ -575,7 +575,7 @@ def current_license_cached_value it 'expires the current_license cached value' do expect(current_license_cached_value).to be_present - License.last.update!(updated_at: Time.current) + described_class.last.update!(updated_at: Time.current) expect(current_license_cached_value).to be_nil end @@ -585,7 +585,7 @@ def current_license_cached_value it 'expires the current_license cached value' do expect(current_license_cached_value).to be_present - License.last.destroy! + described_class.last.destroy! expect(current_license_cached_value).to be_nil end @@ -758,7 +758,7 @@ def current_license_cached_value describe ".block_changes?" do before do - allow(License).to receive(:current).and_return(license) + allow(described_class).to receive(:current).and_return(license) end context "when there is no current license" do @@ -806,31 +806,31 @@ def current_license_cached_value context 'when license trial' do before do allow(license).to receive(:trial?).and_return(true) - allow(License).to receive(:current).and_return(license) + allow(described_class).to receive(:current).and_return(license) end it 'does not yield block' do - expect { |b| License.with_valid_license(&b) }.not_to yield_control + expect { |b| described_class.with_valid_license(&b) }.not_to yield_control end end context 'when license nil' do before do - allow(License).to receive(:current).and_return(nil) + allow(described_class).to receive(:current).and_return(nil) end it 'does not yield block' do - expect { |b| License.with_valid_license(&b) }.not_to yield_control + expect { |b| described_class.with_valid_license(&b) }.not_to yield_control end end context 'when license is valid' do before do - allow(License).to receive(:current).and_return(license) + allow(described_class).to receive(:current).and_return(license) end it 'yields block' do - expect { |b| License.with_valid_license(&b) }.to yield_with_args(license) + expect { |b| described_class.with_valid_license(&b) }.to yield_with_args(license) end end end @@ -841,7 +841,7 @@ def current_license_cached_value let(:license_key) { 'test-key' } before do - allow(License).to receive(:current).and_return(current_license) + allow(described_class).to receive(:current).and_return(current_license) end context 'when current license is not set' do @@ -1455,7 +1455,7 @@ def build_license_with_add_ons(add_ons, plan: nil) undecryptable_license = create(:license) allow(undecryptable_license).to receive(:license).and_return(nil) - allow(License).to receive(:all).and_return([undecryptable_license]) + allow(described_class).to receive(:all).and_return([undecryptable_license]) expect(described_class.history.map(&:id)).to be_empty end @@ -1691,7 +1691,7 @@ def set_restrictions(opts) context 'when the license is not the current license' do before do - allow(License).to receive(:current).and_return(create(:license)) + allow(described_class).to receive(:current).and_return(create(:license)) end it { is_expected.to be false } @@ -1699,7 +1699,7 @@ def set_restrictions(opts) context 'when there is no current license' do before do - allow(License).to receive(:current).and_return(nil) + allow(described_class).to receive(:current).and_return(nil) end it { is_expected.to be false } diff --git a/ee/spec/models/project_import_state_spec.rb b/ee/spec/models/project_import_state_spec.rb index 64b46251727a6..8a6acc42a30e6 100644 --- a/ee/spec/models/project_import_state_spec.rb +++ b/ee/spec/models/project_import_state_spec.rb @@ -627,7 +627,7 @@ let!(:jitter) { 2.seconds } before do - allow_any_instance_of(ProjectImportState).to receive(:rand).and_return(jitter) + allow_any_instance_of(described_class).to receive(:rand).and_return(jitter) end context 'when base delay is lower than mirror_max_delay' do diff --git a/ee/spec/models/release_highlight_spec.rb b/ee/spec/models/release_highlight_spec.rb index d4e48ef6d2360..9ca6f24795478 100644 --- a/ee/spec/models/release_highlight_spec.rb +++ b/ee/spec/models/release_highlight_spec.rb @@ -15,7 +15,7 @@ end after do - ReleaseHighlight.instance_variable_set(:@file_paths, nil) + described_class.instance_variable_set(:@file_paths, nil) end describe '.load_items' do diff --git a/ee/spec/models/requirements_management/test_report_spec.rb b/ee/spec/models/requirements_management/test_report_spec.rb index a986d56fcd18a..2210a732b7637 100644 --- a/ee/spec/models/requirements_management/test_report_spec.rb +++ b/ee/spec/models/requirements_management/test_report_spec.rb @@ -99,7 +99,7 @@ it 'creates test report with expected status for each open requirement' do expect { subject }.to change { RequirementsManagement::TestReport.count }.by(2) - reports = RequirementsManagement::TestReport.where(build: build) + reports = described_class.where(build: build) requirement_type_id = WorkItems::Type.requirement.first.id expect(reports).to match_array( @@ -127,7 +127,7 @@ it 'creates test report with expected status for each open requirement' do expect { subject }.to change { RequirementsManagement::TestReport.count }.by(2) - reports = RequirementsManagement::TestReport.where(build: build) + reports = described_class.where(build: build) requirement_type_id = WorkItems::Type.requirement.first.id expect(reports).to match_array( @@ -168,7 +168,7 @@ expect { subject }.to change { RequirementsManagement::TestReport.count }.by(2) - reports = RequirementsManagement::TestReport.where(build: build) + reports = described_class.where(build: build) requirement_type_id = WorkItems::Type.requirement.first.id expect(reports).to match_array( diff --git a/ee/spec/models/resource_weight_event_spec.rb b/ee/spec/models/resource_weight_event_spec.rb index b413ec6376ab2..2e1dffc657fc5 100644 --- a/ee/spec/models/resource_weight_event_spec.rb +++ b/ee/spec/models/resource_weight_event_spec.rb @@ -44,13 +44,13 @@ let_it_be(:event3) { create(:resource_weight_event, issue: issue1) } it 'returns the expected records for an issue with events' do - events = ResourceWeightEvent.by_issue(issue1) + events = described_class.by_issue(issue1) expect(events).to contain_exactly(event1, event3) end it 'returns the expected records for an issue with no events' do - events = ResourceWeightEvent.by_issue(issue3) + events = described_class.by_issue(issue3) expect(events).to be_empty end @@ -66,13 +66,13 @@ let!(:event3) { create(:resource_weight_event, issue: issue2, created_at: created_at3) } it 'returns the expected events' do - events = ResourceWeightEvent.created_after(created_at3) + events = described_class.created_after(created_at3) expect(events).to contain_exactly(event1, event2) end it 'returns no events if time is after last record time' do - events = ResourceWeightEvent.created_after(1.minute.ago) + events = described_class.created_after(1.minute.ago) expect(events).to be_empty end diff --git a/ee/spec/models/uploads/local_spec.rb b/ee/spec/models/uploads/local_spec.rb index 50117cf2aeae6..2e90ee5eb01ae 100644 --- a/ee/spec/models/uploads/local_spec.rb +++ b/ee/spec/models/uploads/local_spec.rb @@ -47,7 +47,7 @@ uploader_class: "FileUploader" }] - expect(::DeleteStoredFilesWorker).to receive(:perform_async).with(Uploads::Local, ['absolute_path']) + expect(::DeleteStoredFilesWorker).to receive(:perform_async).with(described_class, ['absolute_path']) expect(::Geo::UploadReplicator).to receive(:bulk_create_delete_events_async).with(keys_to_delete) data_store.delete_keys_async(keys_to_delete) diff --git a/ee/spec/models/vulnerabilities/flag_spec.rb b/ee/spec/models/vulnerabilities/flag_spec.rb index 80c590dc19887..944942ead7794 100644 --- a/ee/spec/models/vulnerabilities/flag_spec.rb +++ b/ee/spec/models/vulnerabilities/flag_spec.rb @@ -19,7 +19,7 @@ describe '#initialize' do it 'creates a valid flag with flag_type attribute' do - flag = described_class.new(flag_type: Vulnerabilities::Flag.flag_types[:false_positive], origin: 'post analyzer X', description: 'static string to sink', finding: build(:vulnerabilities_finding)) + flag = described_class.new(flag_type: described_class.flag_types[:false_positive], origin: 'post analyzer X', description: 'static string to sink', finding: build(:vulnerabilities_finding)) expect(flag).to be_valid end end diff --git a/ee/spec/services/arkose/blocked_users_report_service_spec.rb b/ee/spec/services/arkose/blocked_users_report_service_spec.rb index 2273b9e7d644f..fd3a44a8d439f 100644 --- a/ee/spec/services/arkose/blocked_users_report_service_spec.rb +++ b/ee/spec/services/arkose/blocked_users_report_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Arkose::BlockedUsersReportService do - let(:service) { Arkose::BlockedUsersReportService.new } + let(:service) { described_class.new } subject { service.execute } let(:arkose_labs_public_api_key) { 'foo' } diff --git a/ee/spec/services/ee/resource_events/synthetic_weight_notes_builder_service_spec.rb b/ee/spec/services/ee/resource_events/synthetic_weight_notes_builder_service_spec.rb index b76cb0878ed82..c9f54bf22d8c8 100644 --- a/ee/spec/services/ee/resource_events/synthetic_weight_notes_builder_service_spec.rb +++ b/ee/spec/services/ee/resource_events/synthetic_weight_notes_builder_service_spec.rb @@ -13,7 +13,7 @@ let_it_be(:event3) { create(:resource_weight_event, issue: issue) } it 'returns the expected synthetic notes' do - notes = EE::ResourceEvents::SyntheticWeightNotesBuilderService.new(issue, user).execute + notes = described_class.new(issue, user).execute expect(notes.size).to eq(3) end diff --git a/ee/spec/services/ee/users/reject_service_spec.rb b/ee/spec/services/ee/users/reject_service_spec.rb index ef57732f3f574..463ca53042a8f 100644 --- a/ee/spec/services/ee/users/reject_service_spec.rb +++ b/ee/spec/services/ee/users/reject_service_spec.rb @@ -8,7 +8,7 @@ describe '#execute', :enable_admin_mode do let_it_be_with_reload(:user) { create(:user, :blocked_pending_approval) } - subject(:reject_user) { Users::RejectService.new(current_user).execute(user) } + subject(:reject_user) { described_class.new(current_user).execute(user) } context 'audit events' do context 'when licensed' do diff --git a/ee/spec/services/security/ingestion/tasks/update_vulnerability_uuids_spec.rb b/ee/spec/services/security/ingestion/tasks/update_vulnerability_uuids_spec.rb index 873399ba049c6..3ea78b327318e 100644 --- a/ee/spec/services/security/ingestion/tasks/update_vulnerability_uuids_spec.rb +++ b/ee/spec/services/security/ingestion/tasks/update_vulnerability_uuids_spec.rb @@ -216,7 +216,7 @@ before do allow(Gitlab::ErrorTracking).to receive(:track_exception) - allow(Security::Ingestion::Tasks::UpdateVulnerabilityUuids).to receive(:update_uuids?).and_return(true) + allow(described_class).to receive(:update_uuids?).and_return(true) allow_next_instance_of(Security::Ingestion::Tasks::UpdateVulnerabilityUuids) do |update| allow(update).to receive(:update_uuids).and_raise(exception) end diff --git a/ee/spec/services/users/captcha_challenge_service_spec.rb b/ee/spec/services/users/captcha_challenge_service_spec.rb index 47b23aea03f3f..ecfd42f598ee1 100644 --- a/ee/spec/services/users/captcha_challenge_service_spec.rb +++ b/ee/spec/services/users/captcha_challenge_service_spec.rb @@ -9,7 +9,7 @@ let(:should_challenge?) { true } let(:result) { { result: should_challenge? } } - subject { Users::CaptchaChallengeService.new(user).execute } + subject { described_class.new(user).execute } context 'when feature flag arkose_labs_login_challenge is disabled' do let(:should_challenge?) { false } @@ -27,7 +27,7 @@ end context 'when the user does not exist' do - subject { Users::CaptchaChallengeService.new(nil).execute } + subject { described_class.new(nil).execute } it { is_expected.to eq(result) } end diff --git a/ee/spec/workers/concerns/elastic/indexing_control_spec.rb b/ee/spec/workers/concerns/elastic/indexing_control_spec.rb index 2b89391c75a43..38cf7c2bdcd01 100644 --- a/ee/spec/workers/concerns/elastic/indexing_control_spec.rb +++ b/ee/spec/workers/concerns/elastic/indexing_control_spec.rb @@ -54,7 +54,7 @@ def self.name describe '.resume_processing!' do before do - expect(Elastic::IndexingControl).to receive(:non_cached_pause_indexing?).and_return(false) + expect(described_class).to receive(:non_cached_pause_indexing?).and_return(false) end it 'triggers job processing if there are jobs' do @@ -74,7 +74,7 @@ def self.name context 'with elasticsearch indexing paused' do before do - expect(Elastic::IndexingControl).to receive(:non_cached_pause_indexing?).and_return(true) + expect(described_class).to receive(:non_cached_pause_indexing?).and_return(true) end it 'adds jobs to the waiting queue' do @@ -98,7 +98,7 @@ def self.name context 'with elasticsearch indexing unpaused' do before do - expect(Elastic::IndexingControl).to receive(:non_cached_pause_indexing?).and_return(false) + expect(described_class).to receive(:non_cached_pause_indexing?).and_return(false) end it 'performs the job' do diff --git a/ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb b/ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb index c3949fcd01813..b0d2d63f80d21 100644 --- a/ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb +++ b/ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb @@ -49,7 +49,7 @@ end it 'RegistryConsistencyWorker gets reenqueued' do - expect(Geo::Secondary::RegistryConsistencyWorker).to receive(:perform_async) + expect(described_class).to receive(:perform_async) subject.perform end @@ -69,7 +69,7 @@ end it 'RegistryConsistencyWorker does not get reenqueued (we will wait until next cronjob)' do - expect(Geo::Secondary::RegistryConsistencyWorker).not_to receive(:perform_async) + expect(described_class).not_to receive(:perform_async) subject.perform end diff --git a/ee/spec/workers/geo/verification_state_backfill_worker_spec.rb b/ee/spec/workers/geo/verification_state_backfill_worker_spec.rb index 7363f3f914fc5..58140291b48fd 100644 --- a/ee/spec/workers/geo/verification_state_backfill_worker_spec.rb +++ b/ee/spec/workers/geo/verification_state_backfill_worker_spec.rb @@ -41,7 +41,7 @@ end it 'worker gets reenqueued' do - expect(Geo::VerificationStateBackfillWorker).to receive(:perform_async) + expect(described_class).to receive(:perform_async) subject.perform(job_args) end @@ -55,7 +55,7 @@ end it 'worker does not get reenqueued (we will wait until next cronjob)' do - expect(Geo::VerificationStateBackfillWorker).not_to receive(:perform_async) + expect(described_class).not_to receive(:perform_async) subject.perform(job_args) end diff --git a/spec/config/settings_spec.rb b/spec/config/settings_spec.rb index 55e675d5107fa..4639e533922ef 100644 --- a/spec/config/settings_spec.rb +++ b/spec/config/settings_spec.rb @@ -170,12 +170,12 @@ it 'defaults to using the encrypted_settings_key_base for the key' do expect(Gitlab::EncryptedConfiguration).to receive(:new).with(hash_including(base_key: Gitlab::Application.secrets.encrypted_settings_key_base)) - Settings.encrypted('tmp/tests/test.enc') + described_class.encrypted('tmp/tests/test.enc') end it 'returns empty encrypted config when a key has not been set' do allow(Gitlab::Application.secrets).to receive(:encrypted_settings_key_base).and_return(nil) - expect(Settings.encrypted('tmp/tests/test.enc').read).to be_empty + expect(described_class.encrypted('tmp/tests/test.enc').read).to be_empty end end diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb index 276bd9b65b92d..88af7d1fe4573 100644 --- a/spec/controllers/repositories/git_http_controller_spec.rb +++ b/spec/controllers/repositories/git_http_controller_spec.rb @@ -79,7 +79,7 @@ end context 'when repository container is a project' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project } let(:user) { project.first_owner } let(:access_checker_class) { Gitlab::GitAccess } @@ -133,7 +133,7 @@ def send_request end context 'when the user is a deploy token' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project } let(:user) { create(:deploy_token, :project, projects: [project]) } let(:access_checker_class) { Gitlab::GitAccess } @@ -144,7 +144,7 @@ def send_request end context 'when repository container is a project wiki' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { create(:project_wiki, :empty_repo, project: project) } let(:user) { project.first_owner } let(:access_checker_class) { Gitlab::GitAccessWiki } @@ -155,7 +155,7 @@ def send_request end context 'when repository container is a personal snippet' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { personal_snippet } let(:user) { personal_snippet.author } let(:access_checker_class) { Gitlab::GitAccessSnippet } @@ -167,7 +167,7 @@ def send_request end context 'when repository container is a project snippet' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project_snippet } let(:user) { project_snippet.author } let(:access_checker_class) { Gitlab::GitAccessSnippet } diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index ef8f8cbce3bf4..461a6390a330e 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -36,7 +36,7 @@ # _published_experiments.html.haml partial. application_experiment.publish - expect(ApplicationExperiment.published_experiments['namespaced/stub']).to include( + expect(described_class.published_experiments['namespaced/stub']).to include( experiment: 'namespaced/stub', excluded: false, key: anything, diff --git a/spec/frontend/fixtures/timezones.rb b/spec/frontend/fixtures/timezones.rb index 2393f4e797db3..f04e647c8ebe2 100644 --- a/spec/frontend/fixtures/timezones.rb +++ b/spec/frontend/fixtures/timezones.rb @@ -4,7 +4,7 @@ RSpec.describe TimeZoneHelper, '(JavaScript fixtures)' do include JavaScriptFixturesHelpers - include TimeZoneHelper + include described_class let(:response) { @timezones.sort_by! { |tz| tz[:name] }.to_json } diff --git a/spec/graphql/gitlab_schema_spec.rb b/spec/graphql/gitlab_schema_spec.rb index 2e0711fe18c10..885bbc82ecc57 100644 --- a/spec/graphql/gitlab_schema_spec.rb +++ b/spec/graphql/gitlab_schema_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe GitlabSchema do - let_it_be(:connections) { GitlabSchema.connections.all_wrappers } + let_it_be(:connections) { described_class.connections.all_wrappers } let_it_be(:tracers) { described_class.tracers } let(:user) { build :user } diff --git a/spec/graphql/graphql_triggers_spec.rb b/spec/graphql/graphql_triggers_spec.rb index 864818351a119..3f58f2678d8e2 100644 --- a/spec/graphql/graphql_triggers_spec.rb +++ b/spec/graphql/graphql_triggers_spec.rb @@ -20,7 +20,7 @@ issuable ) - GraphqlTriggers.issuable_assignees_updated(issuable) + described_class.issuable_assignees_updated(issuable) end end @@ -32,7 +32,7 @@ issuable ).and_call_original - GraphqlTriggers.issuable_title_updated(issuable) + described_class.issuable_title_updated(issuable) end end @@ -44,7 +44,7 @@ issuable ).and_call_original - GraphqlTriggers.issuable_description_updated(issuable) + described_class.issuable_description_updated(issuable) end end @@ -62,7 +62,7 @@ issuable ) - GraphqlTriggers.issuable_labels_updated(issuable) + described_class.issuable_labels_updated(issuable) end end @@ -74,7 +74,7 @@ issuable ).and_call_original - GraphqlTriggers.issuable_dates_updated(issuable) + described_class.issuable_dates_updated(issuable) end end @@ -86,7 +86,7 @@ issuable ).and_call_original - GraphqlTriggers.issuable_milestone_updated(issuable) + described_class.issuable_milestone_updated(issuable) end end @@ -100,7 +100,7 @@ merge_request ).and_call_original - GraphqlTriggers.merge_request_reviewers_updated(merge_request) + described_class.merge_request_reviewers_updated(merge_request) end end @@ -114,7 +114,7 @@ merge_request ).and_call_original - GraphqlTriggers.merge_request_merge_status_updated(merge_request) + described_class.merge_request_merge_status_updated(merge_request) end end @@ -128,7 +128,7 @@ merge_request ).and_call_original - GraphqlTriggers.merge_request_approval_state_updated(merge_request) + described_class.merge_request_approval_state_updated(merge_request) end end @@ -140,7 +140,7 @@ issuable ).and_call_original - GraphqlTriggers.work_item_updated(issuable) + described_class.work_item_updated(issuable) end context 'when triggered with an Issue' do @@ -154,7 +154,7 @@ work_item ).and_call_original - GraphqlTriggers.work_item_updated(issue) + described_class.work_item_updated(issue) end end end diff --git a/spec/graphql/types/global_id_type_spec.rb b/spec/graphql/types/global_id_type_spec.rb index fa0b34113bc61..8ce0bc2b70ade 100644 --- a/spec/graphql/types/global_id_type_spec.rb +++ b/spec/graphql/types/global_id_type_spec.rb @@ -105,12 +105,12 @@ around do |example| # Unset all previously memoized GlobalIDTypes to allow us to define one # that will use the constants stubbed in the `before` block. - previous_id_types = Types::GlobalIDType.instance_variable_get(:@id_types) - Types::GlobalIDType.instance_variable_set(:@id_types, {}) + previous_id_types = described_class.instance_variable_get(:@id_types) + described_class.instance_variable_set(:@id_types, {}) example.run ensure - Types::GlobalIDType.instance_variable_set(:@id_types, previous_id_types) + described_class.instance_variable_set(:@id_types, previous_id_types) end before do diff --git a/spec/initializers/google_api_client_spec.rb b/spec/initializers/google_api_client_spec.rb index b3c4ac5e23b57..cd3e3cf032854 100644 --- a/spec/initializers/google_api_client_spec.rb +++ b/spec/initializers/google_api_client_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Google::Apis::Core::HttpCommand do # rubocop:disable RSpec/FilePath context('with a successful response') do let(:client) { Google::Apis::Core::BaseService.new('', '').client } - let(:command) { Google::Apis::Core::HttpCommand.new(:get, 'https://www.googleapis.com/zoo/animals') } + let(:command) { described_class.new(:get, 'https://www.googleapis.com/zoo/animals') } before do stub_request(:get, 'https://www.googleapis.com/zoo/animals').to_return(body: %(Hello world)) -- GitLab