summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2012-05-14 23:07:36 -0400
committerRobb Kidd <robb@thekidds.org>2012-05-15 22:35:53 -0400
commit345f176a7458ec1f99a2911988f0c4c0cb4d2704 (patch)
tree675fbfeec3677c9e6dc6c7a833aea3ae907c44e6
parent06b45acb8f2491234811a06f01b94af634d58b61 (diff)
downloadgitlab-ce-345f176a7458ec1f99a2911988f0c4c0cb4d2704.tar.gz
Update new_user_email to take id for User and perform find itself.
-rw-r--r--app/mailers/notify.rb6
-rw-r--r--app/models/mailer_observer.rb2
-rw-r--r--spec/mailers/notify_spec.rb4
3 files changed, 6 insertions, 6 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 967be900e07..d702a78ea47 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -7,10 +7,10 @@ class Notify < ActionMailer::Base
default from: EMAIL_OPTS["from"]
- def new_user_email(user, password)
- @user = user
+ def new_user_email(user_id, password)
+ @user = User.find(user_id)
@password = password
- mail(:to => @user['email'], :subject => "gitlab | Account was created for you")
+ mail(:to => @user.email, :subject => "gitlab | Account was created for you")
end
def new_issue_email(issue)
diff --git a/app/models/mailer_observer.rb b/app/models/mailer_observer.rb
index f84cbdead59..940ad1da0b6 100644
--- a/app/models/mailer_observer.rb
+++ b/app/models/mailer_observer.rb
@@ -23,7 +23,7 @@ class MailerObserver < ActiveRecord::Observer
end
def new_user(user)
- Notify.new_user_email(user, user.password).deliver
+ Notify.new_user_email(user.id, user.password).deliver
end
def new_note(note)
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index b8d880c029a..102db485a70 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -19,9 +19,9 @@ describe Notify do
describe 'for new users, the email' do
let(:example_site_url) { root_url }
- let(:new_user) { Factory.new(:user, :email => 'newguy@example.com', :password => 'new_password') }
+ let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') }
- subject { Notify.new_user_email(new_user, new_user.password) }
+ subject { Notify.new_user_email(new_user.id, new_user.password) }
it 'is sent to the new user' do
should deliver_to new_user.email