diff --git a/.rubocop_todo/rspec/described_class.yml b/.rubocop_todo/rspec/described_class.yml index 511f47549ee5141722c1a68c22adc1fb5fbc1577..5868749048adc245ab4a2e5c2bc15245b6ffa805 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 3af9e515fd1809a56f2e484df64fa1b57727c081..19c7f745deb0279dd6b07505db7426b2ae88e099 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 b701f533ba89d7835ebe4d8bf413f30b2cec49c0..c6a61139cf07820ea5b55890cc490db9a8fb0173 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 70ef7140f2aaaa23121d8507a917da151aed5bd6..66c5e20c8fe9111c444a910f61d347fb5aa63d63 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 ee096ff77d76e7053ec1b39274440f93b00005bf..2f8ab6c74cdad698feaf428c865ef333bc4ce3e6 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 a721d9bc146eba967e1673bfd747b34c3accd453..011160fbcec54f9b2cd2c9d7fc6fd7dc676b6d01 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 d313d2acc2ad8f1cd3a29caf06a76651efdcf632..7e5d20fc2987f9c8d19e6f256959cd3d06ea0776 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 de0e685c94a3b00a9679a3563cb721d0374b8e93..01e72bebe76a064fb142364b14d346447b8e79f5 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 8db2e49c9009f81ee2b011c24280d3a96b5e9e89..d79cbec59e86d712051dbd7f42b1f521eeff3642 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 51b734c49455a4e3af106d7509d00314fca7ba90..f4688d247855d673410357409d61225c8d074b2b 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 b182e44bdd3e4c0a6854d13199aa2e37828fc53f..66ca349331142053345d46b25cf30a78e6f17aee 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 0d043917f06c47c2076faa51ba88e82928b51b4b..44842d083f4063a1e7bfad64c5fd3a43ce67ba3f 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 56bac1abacc34bada62c0ab573dd30ea3472d2a1..03fa9fd924e45c90faf88107ba5a8e43069cb4ca 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 caf8a2adf05df476dbc371a524fde5f42c240a49..7e8d17c9f7128812fa29194109e59639a9c1833b 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 a17538cabb5f5b990cc83a2541379706a631225c..81c02c7d421ed43c7926228f5bd2ef70940dc963 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 6f46842ee58fd7283d00865edcc9c6c6df34f026..8768e2f1f1d68f3e78bb7145bc5af097cf6caa63 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 faca9b8c983ff138eb1336e6974db250360d175e..07c829d13037750acd76aa31548ae1abbf5afead 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 141f35e407962b45ca3c6eb5d15c578f5ea0e30e..c4259cae3d094260177108402b1ac1b0acd04ab6 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 bfb333cf182fbf1d41524f8a6208564406b97051..318f6cb9edb512a7fa813014e139f49d2147d3e5 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 2affdaeb4c3861ee9d9362158cb55f7cc6b59c1e..421f21f7bb6d1d142b37c118d3fddfd1b06bbf52 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 8de42ac1fe5e59e6397abbaafd83d86bab62f82e..e0a41ce41ad7fdd2936ace9009a555faa18844f4 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 d850ea8f78ba77f19aedb2b03182fa7bd5e602ea..681781c99ac5f077c486d85e7909075865d79cc7 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 0261b0f9ca5606e839eb3da47e8529ebb44db959..e70ae37973c37dd034d1ab01a3e9d6b3058b94d5 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 e2ec996ca3dec10e2f506dc0b4b87a4dae0ef45e..818e65a566ee4ac7c766529e8385484bc48dd21c 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 e443b3630d5ce151577f5a40a85fe5125ea5db30..7574d14999f91927cc854f0ca793174f63df8eb3 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 64b46251727a6ac962ae90efbd3ae196c3dfc709..8a6acc42a30e6638d06f82176ec5433ffcf9235e 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 d4e48ef6d23606b0505d280f09daade8db7b3398..9ca6f24795478cf35ce0e1ec0a5a8b58b13f926b 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 a986d56fcd18a13ea415cdd3f022990b083acc23..2210a732b76375b53babe60a644993e6812eb5b1 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 b413ec6376ab2a4ce0d9d7613dffc7898597c4fd..2e1dffc657fc519fe12cd58eed02de3ec742dfa9 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 50117cf2aeae688f6d745ad1afc1a12819dea061..2e90ee5eb01ae9c2a3b1b120aced4560a968dc50 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 80c590dc198871bb948eb20fd161f4fc34160928..944942ead77944d266a0bf0203cfc319f2fcff18 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 2273b9e7d644f73b0e35c7677427d9b994b87459..fd3a44a8d439fb2de0b1b9485ef422d94c0a814e 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 b76cb0878ed82b5a54755e9a6c0567bf9e54613f..c9f54bf22d8c8cf2f03298677fed7121cd01c6fd 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 ef57732f3f57404f7cbf644e8b5aa6be24179e6f..463ca53042a8fccea5bf1980c2d585abd0b05940 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 873399ba049c65c0c4fb1e6ea41851dd0c964f01..3ea78b327318e3edb692dac2d30b8f8406aeefbb 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 47b23aea03f3f3bd8ef7ad25c4b91442266095cb..ecfd42f598ee11e914f9d71dfd272f6dcc38149b 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 2b89391c75a43b0f5442166a1e73d4a7604214ba..38cf7c2bdcd01e837ad69257570a215ff14a7827 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 c3949fcd01813c8be1af7fe0102e777a253e655a..b0d2d63f80d2118f08fc1d3927a45ff1a3dfa925 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 7363f3f914fc5b81041904e2c4b7f7414eca6b5b..58140291b48fd7485fdd2876b6933ad452c9772d 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 55e675d5107fa3f9e24cf6ce878fe83734feb132..4639e533922ef6d91a86489c37e9216e828b53aa 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 276bd9b65b92d71d03330a97a762250fa1020d17..88af7d1fe4573774d99200edea6a46ea7dc96c4d 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 ef8f8cbce3bf457baad8fac1637a7158c98f886b..461a6390a330e434f44ac93688fc37650016e489 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 2393f4e797db3445a04cf248f470f52db9606508..f04e647c8ebe22d4fd9dd27807b20b19ef725cd0 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 2e0711fe18c10d5cf1e1fc2c5904e4be8dfa54af..885bbc82ecc57a3fce766a6d1fd7d4a63e379382 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 864818351a119dc872473fb7a9d5aa9af7544de4..3f58f2678d8e2f2d266bfaca3fb035190d225981 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 fa0b34113bc61d9dd252bcd0667c906625668ef8..8ce0bc2b70ade9b718c3f13fa99052a99ee4b1c7 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 b3c4ac5e23b57f73fe31666e9a0707f917ca648a..cd3e3cf0328546a72f83c4b398e2ede3ff1eacae 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))