test: fix not_to raise_error(SpecificErrorClass) false positive risk

This commit is contained in:
Colin Darie 2023-11-09 17:27:55 +01:00
parent c38dac789d
commit edb47d94f7
6 changed files with 7 additions and 7 deletions

View file

@ -32,7 +32,7 @@ RSpec.describe Cron::WeeklyOverviewJob, type: :job do
end end
it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) } it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) }
it { expect { run_job }.not_to raise_error(NoMethodError) } it { expect { run_job }.not_to raise_error }
end end
end end

View file

@ -23,7 +23,7 @@ describe ExportJob do
let(:format) { :zip } let(:format) { :zip }
it 'does not try to identify file' do it 'does not try to identify file' do
expect { subject }.not_to raise_error(ActiveStorage::FileNotFoundError) expect { subject }.not_to raise_error
end end
end end
end end

View file

@ -33,7 +33,7 @@ describe Recovery::AlignChampWithDossierRevision do
expect(fixer.logs.size).to eq(1) expect(fixer.logs.size).to eq(1)
expect(fixer.logs.first.fetch(:status)).to eq(:updated) expect(fixer.logs.first.fetch(:status)).to eq(:updated)
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error(ArgumentError) expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error
expect(bad_dossier.champs.size).to eq(2) expect(bad_dossier.champs.size).to eq(2)
expect(bad_dossier.champs_public.size).to eq(2) expect(bad_dossier.champs_public.size).to eq(2)
end end
@ -60,7 +60,7 @@ describe Recovery::AlignChampWithDossierRevision do
expect(fixer.logs.size).to eq(1) expect(fixer.logs.size).to eq(1)
expect(fixer.logs.first.fetch(:status)).to eq(:not_found) expect(fixer.logs.first.fetch(:status)).to eq(:not_found)
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error(ArgumentError) expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error
expect(bad_dossier.champs.size).to eq(1) expect(bad_dossier.champs.size).to eq(1)
expect(bad_dossier.champs_public.size).to eq(1) expect(bad_dossier.champs_public.size).to eq(1)
end end

View file

@ -30,7 +30,7 @@ describe 'Recovery::Revision::LifeCycle' do
expect(dossier.champs_public.size).to eq(1) expect(dossier.champs_public.size).to eq(1)
expect(dossier.champs.size).to eq(2) expect(dossier.champs.size).to eq(2)
importer.load importer.load
expect { DossierPreloader.load_one(dossier) }.not_to raise_error(ArgumentError) expect { DossierPreloader.load_one(dossier) }.not_to raise_error
expect(dossier.champs_public.size).to eq(2) expect(dossier.champs_public.size).to eq(2)
end end
end end

View file

@ -385,7 +385,7 @@ RSpec.describe DossierCloneConcern do
procedure.publish_revision! procedure.publish_revision!
end end
it 'works' do it 'works' do
expect { subject }.not_to raise_error(ActiveRecord::InvalidForeignKey) expect { subject }.not_to raise_error
end end
end end
end end

View file

@ -489,7 +489,7 @@ describe ProcedureExportService do
subject { service.to_zip } subject { service.to_zip }
context 'without files' do context 'without files' do
it 'does not raises in_batches' do it 'does not raises in_batches' do
expect { subject }.not_to raise_error(NoMethodError) expect { subject }.not_to raise_error
end end
it 'returns an empty blob' do it 'returns an empty blob' do