##// END OF EJS Templates
Fixes password sending when creating user....
Jean-Philippe Lang -
r4386:a49c7f95e236
parent child
Show More
@@ -105,7 +105,7 class UsersController < ApplicationController
105 105 @user.pref.save
106 106 @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
107 107
108 Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
108 Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information]
109 109
110 110 respond_to do |format|
111 111 format.html {
@@ -168,7 +168,41 class UsersControllerTest < ActionController::TestCase
168 168 should_respond_with :success
169 169 should_render_template :new
170 170 end
171
171 end
172
173 def test_create
174 Setting.bcc_recipients = '1'
175
176 assert_difference 'User.count' do
177 assert_difference 'ActionMailer::Base.deliveries.size' do
178 post :create,
179 :user => {
180 :firstname => 'John',
181 :lastname => 'Doe',
182 :login => 'jdoe',
183 :password => 'secret',
184 :password_confirmation => 'secret',
185 :mail => 'jdoe@gmail.com',
186 :mail_notification => 'none'
187 },
188 :send_information => '1'
189 end
190 end
191
192 user = User.first(:order => 'id DESC')
193 assert_redirected_to :controller => 'users', :action => 'edit', :id => user.id
194
195 assert_equal 'John', user.firstname
196 assert_equal 'Doe', user.lastname
197 assert_equal 'jdoe', user.login
198 assert_equal 'jdoe@gmail.com', user.mail
199 assert_equal 'none', user.mail_notification
200 assert user.check_password?('secret')
201
202 mail = ActionMailer::Base.deliveries.last
203 assert_not_nil mail
204 assert_equal [user.mail], mail.bcc
205 assert mail.body.include?('secret')
172 206 end
173 207
174 208 def test_update
General Comments 0
You need to be logged in to leave comments. Login now