Cleaning spec

This commit is contained in:
simon lehericey 2019-11-05 09:52:25 +01:00 committed by Pierre de La Morinerie
parent e3d7688e66
commit aeb44dd2aa

View file

@ -170,14 +170,14 @@ describe User, type: :model do
let(:administrateur) { create(:administrateur) }
let(:user) { administrateur.user }
let(:mailer_double) { double('mailer', deliver_later: true) }
before { allow(AdministrationMailer).to receive(:invite_admin).and_return(mailer_double) }
subject { user.invite_administrateur!(administration.id) }
context 'when the user is inactif' do
before do
mailer_double = double('mailer', deliver_later: true)
allow(AdministrationMailer).to receive(:invite_admin).and_return(mailer_double)
subject
end
before { subject }
it { expect(AdministrationMailer).to have_received(:invite_admin).with(user, kind_of(String), administration.id) }
end
@ -185,8 +185,6 @@ describe User, type: :model do
context 'when the user is actif' do
before do
user.update(last_sign_in_at: Time.zone.now)
mailer_double = double('mailer', deliver_later: true)
allow(AdministrationMailer).to receive(:invite_admin).and_return(mailer_double)
subject
end