Commit 345f176a7458ec1f99a2911988f0c4c0cb4d2704
1 parent
06b45acb
Exists in
master
and in
4 other branches
Update new_user_email to take id for User and perform find itself.
Showing
3 changed files
with
6 additions
and
6 deletions
Show diff stats
app/mailers/notify.rb
| @@ -7,10 +7,10 @@ class Notify < ActionMailer::Base | @@ -7,10 +7,10 @@ class Notify < ActionMailer::Base | ||
| 7 | 7 | ||
| 8 | default from: EMAIL_OPTS["from"] | 8 | default from: EMAIL_OPTS["from"] |
| 9 | 9 | ||
| 10 | - def new_user_email(user, password) | ||
| 11 | - @user = user | 10 | + def new_user_email(user_id, password) |
| 11 | + @user = User.find(user_id) | ||
| 12 | @password = password | 12 | @password = password |
| 13 | - mail(:to => @user['email'], :subject => "gitlab | Account was created for you") | 13 | + mail(:to => @user.email, :subject => "gitlab | Account was created for you") |
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | def new_issue_email(issue) | 16 | def new_issue_email(issue) |
app/models/mailer_observer.rb
| @@ -23,7 +23,7 @@ class MailerObserver < ActiveRecord::Observer | @@ -23,7 +23,7 @@ class MailerObserver < ActiveRecord::Observer | ||
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | def new_user(user) | 25 | def new_user(user) |
| 26 | - Notify.new_user_email(user, user.password).deliver | 26 | + Notify.new_user_email(user.id, user.password).deliver |
| 27 | end | 27 | end |
| 28 | 28 | ||
| 29 | def new_note(note) | 29 | def new_note(note) |
spec/mailers/notify_spec.rb
| @@ -19,9 +19,9 @@ describe Notify do | @@ -19,9 +19,9 @@ describe Notify do | ||
| 19 | 19 | ||
| 20 | describe 'for new users, the email' do | 20 | describe 'for new users, the email' do |
| 21 | let(:example_site_url) { root_url } | 21 | let(:example_site_url) { root_url } |
| 22 | - let(:new_user) { Factory.new(:user, :email => 'newguy@example.com', :password => 'new_password') } | 22 | + let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') } |
| 23 | 23 | ||
| 24 | - subject { Notify.new_user_email(new_user, new_user.password) } | 24 | + subject { Notify.new_user_email(new_user.id, new_user.password) } |
| 25 | 25 | ||
| 26 | it 'is sent to the new user' do | 26 | it 'is sent to the new user' do |
| 27 | should deliver_to new_user.email | 27 | should deliver_to new_user.email |