summaryrefslogtreecommitdiffstats
path: root/test/functional/users_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-17 12:41:48 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-17 12:41:48 +0000
commit07935e093d9b963f1ffcdef35fbe727b8e2c04cc (patch)
treec3e5a425dbaf2001ec57d5e8abac5e038c90a014 /test/functional/users_controller_test.rb
parent14e8f3009c92914d56228edd95fd3952211948c8 (diff)
downloadredmine-07935e093d9b963f1ffcdef35fbe727b8e2c04cc.tar.gz
redmine-07935e093d9b963f1ffcdef35fbe727b8e2c04cc.zip
use with_settings at UsersControllerTest#test_update_with_generate_password_should_email_the_password
git-svn-id: http://svn.redmine.org/redmine/trunk@20413 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/users_controller_test.rb')
-rw-r--r--test/functional/users_controller_test.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 4d3f877b2..dfc6be848 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -592,24 +592,28 @@ class UsersControllerTest < Redmine::ControllerTest
def test_update_with_generate_password_should_email_the_password
ActionMailer::Base.deliveries.clear
- Setting.bcc_recipients = '1'
-
- put :update, :params => {
- :id => 2,
- :user => {
- :generate_password => '1',
- :password => '',
- :password_confirmation => ''
- },
- :send_information => '1'
- }
-
+ with_settings :bcc_recipients => '1' do
+ put(
+ :update,
+ :params => {
+ :id => 2,
+ :user => {
+ :generate_password => '1',
+ :password => '',
+ :password_confirmation => ''
+ },
+ :send_information => '1'
+ }
+ )
+ end
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
+ u = User.find(2)
+ assert_equal [u.mail], mail.bcc
m = mail_body(mail).match(/Password: ([a-zA-Z0-9]+)/)
assert m
password = m[1]
- assert User.find(2).check_password?(password)
+ assert u.check_password?(password)
end
def test_update_without_generate_password_should_not_change_password