Fix instructeur invitation

This commit is contained in:
simon lehericey 2019-08-07 15:52:38 +02:00
parent efd793f266
commit 5fdac38cb2
12 changed files with 86 additions and 113 deletions

View file

@ -149,30 +149,10 @@ describe Admin::InstructeursController, type: :controller do
context 'Email notification' do
it 'Notification email is sent when instructeur is create' do
expect_any_instance_of(Instructeur).to receive(:invite!)
expect_any_instance_of(User).to receive(:invite!)
subject
end
end
context 'unified login' do
before do
subject
end
it "creates associated user with same credentials" do
instructeur = controller.instance_variable_get(:@instructeur)
user = User.find_by(email: instructeur.email)
expect(user.valid_password?(instructeur.password)).to be(true)
end
context 'invalid email' do
let(:email) { 'fail' }
it "won't create associated user" do
expect(User.where(email: email).exists?).to be(false)
end
end
end
end
describe 'DELETE #destroy' do