DubiousProcedure: improve spec

This commit is contained in:
simon lehericey 2018-05-30 14:21:17 +02:00
parent 9f06308dbd
commit c00f56d454
2 changed files with 8 additions and 2 deletions

View file

@ -119,6 +119,12 @@ FactoryBot.define do
end
end
trait :whitelisted do
after(:build) do |procedure, _evaluator|
procedure.update(whitelisted_at: DateTime.now)
end
end
trait :with_notice do
after(:create) do |procedure, _evaluator|
procedure.notice.attach(

View file

@ -35,13 +35,13 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
end
context 'and a whitelisted procedure' do
let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) }
let(:procedure) { create(:procedure, :whitelisted) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end
context 'and a archived procedure' do
let(:procedure) { create(:procedure, archived_at: DateTime.now) }
let(:procedure) { create(:procedure, :archived) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end