do not run ApiEntreprise jobs on missing etablissements

This commit is contained in:
clemkeirua 2020-09-28 14:37:34 +02:00
parent dd43c46e5e
commit 245e9e59c7
2 changed files with 14 additions and 0 deletions

View file

@ -18,4 +18,14 @@ RSpec.describe ApiEntreprise::AssociationJob, type: :job do
subject
expect(Etablissement.find(etablissement.id).association_rna).to eq('W595001988')
end
context "when the etablissement has been deleted" do
before do
allow_any_instance_of(Etablissement).to receive(:find) { raise ActiveRecord::RecordNotFound }
end
it "ignores the error" do
expect { subject }.not_to raise_error
end
end
end