Commit 345f176a authored by Robb Kidd's avatar Robb Kidd

Update new_user_email to take id for User and perform find itself.

parent 06b45acb
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment