Send email when user create new account
This commit is contained in:
parent
372011e4d6
commit
4aedf72631
5 changed files with 36 additions and 6 deletions
|
@ -8,9 +8,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
# end
|
||||
|
||||
# POST /resource
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
def create
|
||||
retour = super
|
||||
WelcomeMailer.welcome_email(User.last).deliver_now!
|
||||
retour
|
||||
end
|
||||
|
||||
# GET /resource/edit
|
||||
# def edit
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
-# </div>
|
||||
-#<% end %>
|
||||
|
||||
= devise_error_messages!
|
||||
|
||||
#form_login
|
||||
= image_tag('logo-tps.png')
|
||||
%br
|
||||
|
|
|
@ -37,7 +37,7 @@ Rails.application.configure do
|
|||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
config.action_mailer.delivery_method = :mailjet
|
||||
config.action_mailer.delivery_method = :test
|
||||
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||
|
||||
# Raises error for missing translations
|
||||
|
|
|
@ -63,8 +63,8 @@ ActiveRecord::Schema.define(version: 20151214133426) do
|
|||
t.boolean "autorisation_donnees"
|
||||
t.string "nom_projet"
|
||||
t.integer "procedure_id"
|
||||
t.datetime "created_at", default: '2015-12-07 09:51:46'
|
||||
t.datetime "updated_at", default: '2015-12-07 09:51:46'
|
||||
t.datetime "created_at", default: '2015-12-07 09:51:23'
|
||||
t.datetime "updated_at", default: '2015-12-07 09:51:23'
|
||||
t.string "state"
|
||||
t.integer "user_id"
|
||||
t.text "json_latlngs"
|
||||
|
|
26
spec/controllers/users/registrations_controller_spec.rb
Normal file
26
spec/controllers/users/registrations_controller_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
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 }
|
||||
|
||||
it { expect(described_class).to be < Devise::RegistrationsController }
|
||||
|
||||
it 'welcome email is send' do
|
||||
expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer)
|
||||
expect(WelcomeMailer).to receive(:deliver_now!)
|
||||
|
||||
subject
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue