demarches-normaliennes/spec/controllers/users/registrations_controller_spec.rb
Xavier J e8fd212d13 - Code review
- Delete Mandataires sociaux adapter
- Add function to get mandataires sociaux in Enterprise Adapter
2016-01-19 17:19:38 +01:00

38 lines
982 B
Ruby

require 'spec_helper'
describe Users::RegistrationsController, type: :controller do
let(:email) { 'test@octo.com' }
let(:password) { 'password' }
let(:user) { {email: email, password: password, password_confirmation: password} }
before do
@request.env["devise.mapping"] = Devise.mappings[:user]
end
describe '.create' do
subject { post :create, user: user }
context 'when user is correct' do
it { expect(described_class).to be < Devise::RegistrationsController }
it 'sends welcome email' do
expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer)
expect(WelcomeMailer).to receive(:deliver_now!)
subject
end
end
context 'when user is not correct' do
let(:user) { {email: '', password: password, password_confirmation: password} }
it 'not sends welcome email' do
expect(WelcomeMailer).not_to receive(:welcome_email)
subject
end
end
end
end