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 | 7 | |
8 | 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 | 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 | 14 | end |
15 | 15 | |
16 | 16 | def new_issue_email(issue) | ... | ... |
app/models/mailer_observer.rb
spec/mailers/notify_spec.rb
... | ... | @@ -19,9 +19,9 @@ describe Notify do |
19 | 19 | |
20 | 20 | describe 'for new users, the email' do |
21 | 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 | 26 | it 'is sent to the new user' do |
27 | 27 | should deliver_to new_user.email | ... | ... |