diff --git a/ee/spec/lib/ee/api/helpers_spec.rb b/ee/spec/lib/ee/api/helpers_spec.rb index 5c84ae47094700310b6399a931147eace24e0491..a6d3d661b6fa786795a21160618575e27b436044 100644 --- a/ee/spec/lib/ee/api/helpers_spec.rb +++ b/ee/spec/lib/ee/api/helpers_spec.rb @@ -73,11 +73,15 @@ def app end context 'unauthorized param' do + let(:exception) { Exception.new('Forbidden') } + before do - allow(subject).to receive(:authorize!).and_raise(Exception.new("Forbidden")) + allow(subject).to receive(:authorize!).and_raise(exception) end + it 'throws exception if unauthorized param is present' do - expect { subject.authorize_change_param(project, :change_commit_committer_check) }.to raise_error + expect { subject.authorize_change_param(project, :change_commit_committer_check) } + .to raise_error(exception) end it 'does not throw exception is unauthorized param is not present' do diff --git a/ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb b/ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb index ca458768146ae9b6d7dd254af47c728d69cf2d9b..75ad658a45e97ab0b3eb60f0707de8623e947d9a 100644 --- a/ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb +++ b/ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb @@ -347,7 +347,7 @@ def create_data_for_end_event(issue, example_class) subject { described_class.new(stage: stage, params: params) } it 'does not raise query syntax error' do - expect { subject.records_fetcher.serialized_records }.not_to raise_error(ActiveRecord::StatementInvalid) + expect { subject.records_fetcher.serialized_records }.not_to raise_error end end end diff --git a/ee/spec/lib/gitlab/middleware/ip_restrictor_spec.rb b/ee/spec/lib/gitlab/middleware/ip_restrictor_spec.rb index c5689854749c558fabd2be593e961f44114cdd4e..599d88895d92b8c2012ee692286cde1d4f3186c8 100644 --- a/ee/spec/lib/gitlab/middleware/ip_restrictor_spec.rb +++ b/ee/spec/lib/gitlab/middleware/ip_restrictor_spec.rb @@ -30,7 +30,7 @@ expect(::Gitlab::IpAddressState).to receive(:nullify_address) expect(app).to receive(:call).and_raise('boom') - expect { middleware.call(env) }.to raise_error + expect { middleware.call(env) }.to raise_error('boom') end context 'when it is internal endpoint' do diff --git a/ee/spec/models/ee/iteration_spec.rb b/ee/spec/models/ee/iteration_spec.rb index 3cf4f1388258e19452fcf9ad802fe1e27a61854f..e3e5d0bd50140aec3c411899f098bf9e89bf93d5 100644 --- a/ee/spec/models/ee/iteration_spec.rb +++ b/ee/spec/models/ee/iteration_spec.rb @@ -417,8 +417,8 @@ it "does not raise an error on creation with a unique sequence number within a cadence", :aggregate_failures do expect do - create(:iteration, :with_due_date, sequence: 2, iterations_cadence: iterations_cadence1, start_date: 2.weeks.from_now) - end.not_to raise_error(ActiveRecord::RecordNotUnique) + create(:iteration, :with_due_date, sequence: 2, iterations_cadence: iterations_cadence, start_date: 2.weeks.from_now) + end.not_to raise_error end end @@ -481,7 +481,7 @@ iteration1.update_columns(dates2) iteration2.update_columns(dates1) end - end.not_to raise_exception(ActiveRecord::StatementInvalid, /PG::ExclusionViolation/) + end.not_to raise_exception end end end diff --git a/ee/spec/services/audit_event_service_spec.rb b/ee/spec/services/audit_event_service_spec.rb index 663bd0b852ae62ec91cbc3fbcf7b55f6f9f38a50..e95e7a631ccfea597d920111f05de483350fc47e 100644 --- a/ee/spec/services/audit_event_service_spec.rb +++ b/ee/spec/services/audit_event_service_spec.rb @@ -672,10 +672,8 @@ def disable_license_audit_features context 'when the event is created within a transaction' do it 'does not raise an error about a job being enqueued from within a transaction' do - RSpec::Expectations.configuration.on_potential_false_positives = :nothing - ApplicationRecord.transaction do - expect { event }.not_to raise_error(Sidekiq::Worker::EnqueueFromTransactionError) + expect { event }.not_to raise_error end end end diff --git a/ee/spec/services/ee/groups/import_export/import_service_spec.rb b/ee/spec/services/ee/groups/import_export/import_service_spec.rb index 66f3b23c04bddf26a7e0e6823cb8840718197be8..4b726b36c2dba7ca8d0638481a8d488baf54a3eb 100644 --- a/ee/spec/services/ee/groups/import_export/import_service_spec.rb +++ b/ee/spec/services/ee/groups/import_export/import_service_spec.rb @@ -56,7 +56,7 @@ it 'does not call the group wiki restorer' do expect(::Gitlab::ImportExport::RepoRestorer).not_to receive(:new) - expect { import_service.execute }.not_to raise_error(Gitlab::ImportExport::Error) + expect { import_service.execute }.not_to raise_error end end end diff --git a/ee/spec/support/shared_examples/services/ci/play_job_service_shared_examples.rb b/ee/spec/support/shared_examples/services/ci/play_job_service_shared_examples.rb index ff2c2e8504875d0d8b5f03a9cbfb080109b6f178..c92ccf59f87a9c3dd6687fd2b8aa1c7f8f7d76e3 100644 --- a/ee/spec/support/shared_examples/services/ci/play_job_service_shared_examples.rb +++ b/ee/spec/support/shared_examples/services/ci/play_job_service_shared_examples.rb @@ -14,7 +14,7 @@ end it 'does not raise any exception' do - expect { subject }.not_to raise_error(::Gitlab::Access::AccessDeniedError) + expect { subject }.not_to raise_error end end diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index e9f1232b5e7d748897aaa4578a1a8bf53091fb14..162c36f5069bfd3edfaf0707b79b526ca07b7739 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -929,13 +929,13 @@ def post_play context 'when continue url is present' do let(:job) { create(:ci_build, :cancelable, pipeline: pipeline) } + before do + post_cancel(continue: { to: url }) + end + context 'when continue to is a safe url' do let(:url) { '/test' } - before do - post_cancel(continue: { to: url }) - end - it 'redirects to the continue url' do expect(response).to have_gitlab_http_status(:found) expect(response).to redirect_to(url) @@ -949,8 +949,9 @@ def post_play context 'when continue to is not a safe url' do let(:url) { 'http://example.com' } - it 'raises an error' do - expect { cancel_with_redirect(url) }.to raise_error + it 'redirects to the builds page' do + expect(response).to have_gitlab_http_status(:found) + expect(response).to redirect_to(builds_namespace_project_pipeline_path(id: pipeline.id)) end end end diff --git a/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb b/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb index a111007a984e79b1b00323694f71f6bedcae6167..65d55f85a984cdc20fe9897d1f40cebfdf30e5f9 100644 --- a/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb +++ b/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb @@ -29,7 +29,7 @@ # Tagging records expect { tagging_1.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { tagging_2.reload }.to raise_error(ActiveRecord::RecordNotFound) - expect { other_tagging.reload }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { other_tagging.reload }.not_to raise_error expect { tagging_3.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { tagging_4.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { tagging_5.reload }.to raise_error(ActiveRecord::RecordNotFound) diff --git a/spec/lib/gitlab/checks/branch_check_spec.rb b/spec/lib/gitlab/checks/branch_check_spec.rb index c06d26d1441d168dedcc3343a53f3e81c3e9a727..d6280d3c28cecacd87f8040a4ed4989847fbec4a 100644 --- a/spec/lib/gitlab/checks/branch_check_spec.rb +++ b/spec/lib/gitlab/checks/branch_check_spec.rb @@ -103,7 +103,7 @@ it 'prevents force push' do expect(Gitlab::Checks::ForcePush).to receive(:force_push?).and_return(true) - expect { subject.validate! }.to raise_error + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError) end end end @@ -126,7 +126,7 @@ it 'prevents force push' do expect(Gitlab::Checks::ForcePush).to receive(:force_push?).and_return(true) - expect { subject.validate! }.to raise_error + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError) end end @@ -141,7 +141,7 @@ it 'prevents force push' do expect(Gitlab::Checks::ForcePush).to receive(:force_push?).and_return(true) - expect { subject.validate! }.to raise_error + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError) end end end diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 28fd00116737b8cef2ca79ef50d7ce5b1e7ab526..fd80cf3b3967469b6e7d6b96f4e5c12dcd243391 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -3180,15 +3180,15 @@ def setup context 'without proper permissions' do before do - allow(model).to receive(:execute).with(/CREATE EXTENSION IF NOT EXISTS #{extension}/).and_raise(ActiveRecord::StatementInvalid, 'InsufficientPrivilege: permission denied') + allow(model).to receive(:execute) + .with(/CREATE EXTENSION IF NOT EXISTS #{extension}/) + .and_raise(ActiveRecord::StatementInvalid, 'InsufficientPrivilege: permission denied') end - it 'raises the exception' do - expect { subject }.to raise_error(ActiveRecord::StatementInvalid, /InsufficientPrivilege/) - end - - it 'prints an error message' do - expect { subject }.to output(/user is not allowed/).to_stderr.and raise_error + it 'raises an exception and prints an error message' do + expect { subject } + .to output(/user is not allowed/).to_stderr + .and raise_error(ActiveRecord::StatementInvalid, /InsufficientPrivilege/) end end end @@ -3206,15 +3206,15 @@ def setup context 'without proper permissions' do before do - allow(model).to receive(:execute).with(/DROP EXTENSION IF EXISTS #{extension}/).and_raise(ActiveRecord::StatementInvalid, 'InsufficientPrivilege: permission denied') - end - - it 'raises the exception' do - expect { subject }.to raise_error(ActiveRecord::StatementInvalid, /InsufficientPrivilege/) + allow(model).to receive(:execute) + .with(/DROP EXTENSION IF EXISTS #{extension}/) + .and_raise(ActiveRecord::StatementInvalid, 'InsufficientPrivilege: permission denied') end - it 'prints an error message' do - expect { subject }.to output(/user is not allowed/).to_stderr.and raise_error + it 'raises an exception and prints an error message' do + expect { subject } + .to output(/user is not allowed/).to_stderr + .and raise_error(ActiveRecord::StatementInvalid, /InsufficientPrivilege/) end end end diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb index 59b87c5d8e74d1f37e5c0187f5a93a71717a8ecc..9ff395070ea454f3f661eafc5aa048cc13de208d 100644 --- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb @@ -62,7 +62,7 @@ end it 'does not raise a UserNotFoundError' do - expect { receiver.execute }.not_to raise_error(Gitlab::Email::UserNotFoundError) + expect { receiver.execute }.not_to raise_error end end end @@ -71,7 +71,7 @@ let(:original_recipient) { User.support_bot } it 'does not raise a UserNotFoundError' do - expect { receiver.execute }.not_to raise_error(Gitlab::Email::UserNotFoundError) + expect { receiver.execute }.not_to raise_error end end end diff --git a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb index 8bd873cf00897ea541181bf757f7d2001739d691..dfa18c27d5e2cd2b30c52537e5d794e1863c6946 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb @@ -24,7 +24,7 @@ let(:series) { 0 } it 'does not raise error' do - expect { subject }.not_to raise_error(ArgumentError) + expect { subject }.not_to raise_error end end end diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb index 4c47912e218525f7555d0ab7746da548e74f25f1..2c931a999f196ac6c3beb5bdd7ce7bd113644fd3 100644 --- a/spec/lib/gitlab/git/diff_spec.rb +++ b/spec/lib/gitlab/git/diff_spec.rb @@ -177,9 +177,9 @@ expect(diff_two.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER) expect(diff_three.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER) - expect { Oj.dump(diff) }.not_to raise_error(EncodingError) - expect { Oj.dump(diff_two) }.not_to raise_error(EncodingError) - expect { Oj.dump(diff_three) }.not_to raise_error(EncodingError) + expect { Oj.dump(diff) }.not_to raise_error + expect { Oj.dump(diff_two) }.not_to raise_error + expect { Oj.dump(diff_three) }.not_to raise_error end context 'when the diff is binary' do diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb index 8211806a809d12266981d302ffcfb4c91e1ae2b1..0a186b07d19e0936248af6813c4848052518bccc 100644 --- a/spec/lib/gitlab/popen_spec.rb +++ b/spec/lib/gitlab/popen_spec.rb @@ -103,7 +103,7 @@ it 'raises error' do expect do @klass.new.popen(%w[foobar]) - end.to raise_error + end.to raise_error(Errno::ENOENT) end end end diff --git a/spec/lib/gitlab/tracking/event_definition_spec.rb b/spec/lib/gitlab/tracking/event_definition_spec.rb index 51c628408197f476b8653f02e1f5e7be8b3a8e66..623009e9a3013c4713203bc5d087d703b40c3bf1 100644 --- a/spec/lib/gitlab/tracking/event_definition_spec.rb +++ b/spec/lib/gitlab/tracking/event_definition_spec.rb @@ -33,7 +33,7 @@ def write_metric(metric, path, content) end it 'has all definitions valid' do - expect { described_class.definitions }.not_to raise_error(Gitlab::Tracking::InvalidEventError) + expect { described_class.definitions }.not_to raise_error end describe '#validate' do diff --git a/spec/migrations/finalize_project_namespaces_backfill_spec.rb b/spec/migrations/finalize_project_namespaces_backfill_spec.rb index 3d0b0ec13fe0190fe370e0a2cfef82c251991c58..f70f1612f9ddbc1be4420d3418d00a8cc53cd3ee 100644 --- a/spec/migrations/finalize_project_namespaces_backfill_spec.rb +++ b/spec/migrations/finalize_project_namespaces_backfill_spec.rb @@ -42,7 +42,7 @@ context 'when project namespace backfilling migration finished successfully' do it 'does not raise exception' do - expect { migrate! }.not_to raise_error(/Expected batched background migration for the given configuration to be marked as 'finished'/) + expect { migrate! }.not_to raise_error end end diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 8c0f07047e4d140904b1cc2080f4c940b07b5766..a0ede9fb0d92389ecf14ef219fa48415f4d725d1 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -494,7 +494,7 @@ end it 'does not raise kubeclient http error' do - expect { subject }.not_to raise_error(Kubeclient::HttpError) + expect { subject }.not_to raise_error end end diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb index 4f3b95e43cd8ae154249ecb615210aa44fcb4a5a..5468699f9ddf0bf6ce89a22550474f14d566b036 100644 --- a/spec/models/concerns/reactive_caching_spec.rb +++ b/spec/models/concerns/reactive_caching_spec.rb @@ -237,7 +237,7 @@ def self.from_cache(*args); end end it 'does not raise the exception' do - expect { go! }.not_to raise_exception(ReactiveCaching::ExceededReactiveCacheLimit) + expect { go! }.not_to raise_exception end end diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 3cab2b67ec50b942fceb86064ee098a43c48ac05..2769e94cef74689e87fb954b651f0582b07339f4 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -621,7 +621,7 @@ expect(close_action.processed).to be_falsey # it encounters the StaleObjectError at first, but reloads the object and runs `build.play` - expect { subject }.not_to raise_error(ActiveRecord::StaleObjectError) + expect { subject }.not_to raise_error # Now the build should be processed. expect(close_action.reload.processed).to be_truthy diff --git a/spec/models/integration_spec.rb b/spec/models/integration_spec.rb index b7f75bfe8bf45e558e0b9a971a346d7f6d2ba9aa..7d4a50788f3bd3320f06a4fa8f30374022d36a69 100644 --- a/spec/models/integration_spec.rb +++ b/spec/models/integration_spec.rb @@ -681,7 +681,7 @@ integration.properties = { foo: 1, bar: 2 } - expect { integration.properties[:foo] = 3 }.to raise_error + expect { integration.properties[:foo] = 3 }.to raise_error(FrozenError) end end diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb index 6c86db1197f8d87eff03d88857e648cd65a4f499..a9ed811e77d23fd30f93d5c1e7fd975cb3ada405 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -1182,7 +1182,7 @@ it "plan_limits includes column #{plan_limit_name}" do expect { package.project.actual_limits.send(plan_limit_name) } - .not_to raise_error(NoMethodError) + .not_to raise_error end end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 42fe9f0314109712527a2dbda24ebb0ab96b7e17..d315b62b23ec556586d47c16ca8ce9bbdd8ed54f 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2030,7 +2030,7 @@ def has_external_wiki it 'returns nil if the path detection throws an error' do expect(Rails.application.routes).to receive(:recognize_path).with(url) { raise ActionController::RoutingError, 'test' } - expect { subject }.not_to raise_error(ActionController::RoutingError) + expect { subject }.not_to raise_error expect(subject).to be_nil end end diff --git a/spec/models/protected_branch/push_access_level_spec.rb b/spec/models/protected_branch/push_access_level_spec.rb index 13d33b95b169ee75d4773b73bf1cb3970f78df78..008ae6275f034b129ee45f2fde2d1e34fe1ac6be 100644 --- a/spec/models/protected_branch/push_access_level_spec.rb +++ b/spec/models/protected_branch/push_access_level_spec.rb @@ -30,7 +30,7 @@ it 'checks that a deploy key is enabled for the same project as the protected branch\'s' do level = build(:protected_branch_push_access_level, deploy_key: create(:deploy_key)) - expect { level.save! }.to raise_error + expect { level.save! }.to raise_error(ActiveRecord::RecordInvalid) expect(level.errors.full_messages).to contain_exactly('Deploy key is not enabled for this project') end end diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb index 125fec61d72b93926596ee88428622ce60507992..4ae1927dccacd1f2546dcf598f907205908c4a6d 100644 --- a/spec/models/release_spec.rb +++ b/spec/models/release_spec.rb @@ -53,7 +53,10 @@ context 'when a release is tied to a milestone for another project' do it 'creates a validation error' do milestone = build(:milestone, project: create(:project)) - expect { release.milestones << milestone }.to raise_error + + expect { release.milestones << milestone } + .to raise_error(ActiveRecord::RecordInvalid, + 'Validation failed: Release does not have the same project as the milestone') end end diff --git a/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb b/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb index 5f6822223ca6630fdb33ac1244ebd35b5b53a5ae..4891e64aab8eac18a99a24512c1b977ed33ca057 100644 --- a/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb +++ b/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb @@ -26,7 +26,7 @@ def mutation_response 'or you don\'t have permission to perform this action'] it 'does not delete cluster agent' do - expect { cluster_agent.reload }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { cluster_agent.reload }.not_to raise_error end end diff --git a/spec/services/ci/pipeline_artifacts/coverage_report_service_spec.rb b/spec/services/ci/pipeline_artifacts/coverage_report_service_spec.rb index b48ea70aa4cde6af339b00aabf5403e34ac683b4..98b01e2b303cb7ca41bc74732ce939e7824cd876 100644 --- a/spec/services/ci/pipeline_artifacts/coverage_report_service_spec.rb +++ b/spec/services/ci/pipeline_artifacts/coverage_report_service_spec.rb @@ -38,7 +38,7 @@ context 'when pipeline artifact has already been created' do it 'do not raise an error and do not persist the same artifact twice' do - expect { 2.times { described_class.new.execute(pipeline) } }.not_to raise_error(ActiveRecord::RecordNotUnique) + expect { 2.times { described_class.new.execute(pipeline) } }.not_to raise_error expect(Ci::PipelineArtifact.count).to eq(1) end diff --git a/spec/services/clusters/agents/delete_service_spec.rb b/spec/services/clusters/agents/delete_service_spec.rb index 1d6bc9618ddd29dd093edadeb708301c5b3cb86d..abe1bdaab27850ccb677df9590a03d95ab61717f 100644 --- a/spec/services/clusters/agents/delete_service_spec.rb +++ b/spec/services/clusters/agents/delete_service_spec.rb @@ -17,7 +17,7 @@ expect(response.status).to eq(:error) expect(response.message).to eq('You have insufficient permissions to delete this cluster agent') - expect { cluster_agent.reload }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { cluster_agent.reload }.not_to raise_error end end diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb index b4a25fd121d07d38d503ab6283280f4ea210456d..30e48b3baf1d5ba09cfbe884adc312a1f5f71951 100644 --- a/spec/support/rspec.rb +++ b/spec/support/rspec.rb @@ -14,6 +14,8 @@ require 'rubocop' require 'rubocop/rspec/support' +RSpec::Expectations.configuration.on_potential_false_positives = :raise + RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.verify_doubled_constant_names = true diff --git a/spec/support/shared_contexts/email_shared_context.rb b/spec/support/shared_contexts/email_shared_context.rb index 0dc66eeb2eea62843be17bcf3c227b3055a5f40c..086cdf50e9d3f97d378d7a2293ed25830c7d0f83 100644 --- a/spec/support/shared_contexts/email_shared_context.rb +++ b/spec/support/shared_contexts/email_shared_context.rb @@ -148,7 +148,7 @@ def service_desk_fixture(path, slug: nil, key: 'mykey') end it 'allows email to only have quoted text', if: forwardable do - expect { receiver.execute }.not_to raise_error(Gitlab::Email::EmptyEmailError) + expect { receiver.execute }.not_to raise_error end end diff --git a/spec/workers/clusters/applications/activate_service_worker_spec.rb b/spec/workers/clusters/applications/activate_service_worker_spec.rb index 019bfe7a7503c1b7876b9335ccb6912e8e96a3be..d13ff76613cf666623b550c297557b0092582148 100644 --- a/spec/workers/clusters/applications/activate_service_worker_spec.rb +++ b/spec/workers/clusters/applications/activate_service_worker_spec.rb @@ -46,7 +46,7 @@ context 'cluster does not exist' do it 'does not raise Record Not Found error' do - expect { described_class.new.perform(0, 'ignored in this context') }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { described_class.new.perform(0, 'ignored in this context') }.not_to raise_error end end end diff --git a/spec/workers/delete_diff_files_worker_spec.rb b/spec/workers/delete_diff_files_worker_spec.rb index cf26dbabb972dfdaa6db15f3ab322a2269cca4c1..c124847ca45ebb8ce6fea865271849a7099de211 100644 --- a/spec/workers/delete_diff_files_worker_spec.rb +++ b/spec/workers/delete_diff_files_worker_spec.rb @@ -34,11 +34,13 @@ end it 'rollsback if something goes wrong' do + error = RuntimeError.new('something went wrong') + expect(MergeRequestDiffFile).to receive_message_chain(:where, :delete_all) - .and_raise + .and_raise(error) expect { described_class.new.perform(merge_request_diff.id) } - .to raise_error + .to raise_error(error) merge_request_diff.reload