Invite_administrateur!: characterization test

This commit is contained in:
simon lehericey 2019-11-05 09:12:14 +01:00 committed by Pierre de La Morinerie
parent 243bc2887f
commit 53c7997081

View file

@ -164,4 +164,22 @@ describe User, type: :model do
end end
end end
end end
describe 'invite_administrateur!' do
let(:administration) { create(:administration) }
let(:administrateur) { create(:administrateur) }
let(:user) { administrateur.user }
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
it { expect(AdministrationMailer).to have_received(:invite_admin).with(user, kind_of(String), administration.id) }
end
end
end end