Refactor: split UsersController#edit into #edit and #update
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4230 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -153,9 +153,9 @@ class UsersControllerTest < ActionController::TestCase
|
||||
|
||||
end
|
||||
|
||||
def test_edit
|
||||
def test_update
|
||||
ActionMailer::Base.deliveries.clear
|
||||
post :edit, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
|
||||
put :update, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
|
||||
|
||||
user = User.find(2)
|
||||
assert_equal 'Changed', user.firstname
|
||||
@@ -165,7 +165,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert ActionMailer::Base.deliveries.empty?
|
||||
end
|
||||
|
||||
def test_edit_with_activation_should_send_a_notification
|
||||
def test_update_with_activation_should_send_a_notification
|
||||
u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr')
|
||||
u.login = 'foo'
|
||||
u.status = User::STATUS_REGISTERED
|
||||
@@ -173,7 +173,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||
ActionMailer::Base.deliveries.clear
|
||||
Setting.bcc_recipients = '1'
|
||||
|
||||
post :edit, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
|
||||
put :update, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
|
||||
assert u.reload.active?
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
assert_not_nil mail
|
||||
@@ -181,12 +181,12 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert mail.body.include?(ll('fr', :notice_account_activated))
|
||||
end
|
||||
|
||||
def test_edit_with_password_change_should_send_a_notification
|
||||
def test_updat_with_password_change_should_send_a_notification
|
||||
ActionMailer::Base.deliveries.clear
|
||||
Setting.bcc_recipients = '1'
|
||||
|
||||
u = User.find(2)
|
||||
post :edit, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
|
||||
put :update, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
|
||||
assert_equal User.hash_password('newpass'), u.reload.hashed_password
|
||||
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
@@ -195,13 +195,13 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert mail.body.include?('newpass')
|
||||
end
|
||||
|
||||
test "POST :edit with a password change to an AuthSource user switching to Internal authentication" do
|
||||
test "put :update with a password change to an AuthSource user switching to Internal authentication" do
|
||||
# Configure as auth source
|
||||
u = User.find(2)
|
||||
u.auth_source = AuthSource.find(1)
|
||||
u.save!
|
||||
|
||||
post :edit, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
|
||||
put :update, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
|
||||
|
||||
assert_equal nil, u.reload.auth_source
|
||||
assert_equal User.hash_password('newpass'), u.reload.hashed_password
|
||||
|
||||
Reference in New Issue
Block a user