Cleaning spec
This commit is contained in:
parent
e3d7688e66
commit
aeb44dd2aa
1 changed files with 5 additions and 7 deletions
|
@ -170,14 +170,14 @@ describe User, type: :model do
|
||||||
let(:administrateur) { create(:administrateur) }
|
let(:administrateur) { create(:administrateur) }
|
||||||
let(:user) { administrateur.user }
|
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) }
|
subject { user.invite_administrateur!(administration.id) }
|
||||||
|
|
||||||
context 'when the user is inactif' do
|
context 'when the user is inactif' do
|
||||||
before do
|
before { subject }
|
||||||
mailer_double = double('mailer', deliver_later: true)
|
|
||||||
allow(AdministrationMailer).to receive(:invite_admin).and_return(mailer_double)
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(AdministrationMailer).to have_received(:invite_admin).with(user, kind_of(String), administration.id) }
|
it { expect(AdministrationMailer).to have_received(:invite_admin).with(user, kind_of(String), administration.id) }
|
||||||
end
|
end
|
||||||
|
@ -185,8 +185,6 @@ describe User, type: :model do
|
||||||
context 'when the user is actif' do
|
context 'when the user is actif' do
|
||||||
before do
|
before do
|
||||||
user.update(last_sign_in_at: Time.zone.now)
|
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
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue