summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-12 15:26:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-12 15:26:55 +0000
commita49c7f95e236422d560e09a1ecc0555279ab0bbe (patch)
tree4581f1b1663616ef3f252eff2ae76ff8b861cc5b /test
parent0a2ec6ef0472fc0a14fe5793408c0546ebf39e4d (diff)
downloadredmine-a49c7f95e236422d560e09a1ecc0555279ab0bbe.tar.gz
redmine-a49c7f95e236422d560e09a1ecc0555279ab0bbe.zip
Fixes password sending when creating user.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4500 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/users_controller_test.rb36
1 files changed, 35 insertions, 1 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index c9c2c0ee3..d8493740d 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -168,7 +168,41 @@ class UsersControllerTest < ActionController::TestCase
should_respond_with :success
should_render_template :new
end
-
+ end
+
+ def test_create
+ Setting.bcc_recipients = '1'
+
+ assert_difference 'User.count' do
+ assert_difference 'ActionMailer::Base.deliveries.size' do
+ post :create,
+ :user => {
+ :firstname => 'John',
+ :lastname => 'Doe',
+ :login => 'jdoe',
+ :password => 'secret',
+ :password_confirmation => 'secret',
+ :mail => 'jdoe@gmail.com',
+ :mail_notification => 'none'
+ },
+ :send_information => '1'
+ end
+ end
+
+ user = User.first(:order => 'id DESC')
+ assert_redirected_to :controller => 'users', :action => 'edit', :id => user.id
+
+ assert_equal 'John', user.firstname
+ assert_equal 'Doe', user.lastname
+ assert_equal 'jdoe', user.login
+ assert_equal 'jdoe@gmail.com', user.mail
+ assert_equal 'none', user.mail_notification
+ assert user.check_password?('secret')
+
+ mail = ActionMailer::Base.deliveries.last
+ assert_not_nil mail
+ assert_equal [user.mail], mail.bcc
+ assert mail.body.include?('secret')
end
def test_update