TypeError when attempting to update a user with a blank email address (#33355).

Patch by Go MAEDA.


git-svn-id: http://svn.redmine.org/redmine/trunk@20562 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-12-03 15:14:35 +00:00
parent 7c292dd23c
commit c8227930f9
2 changed files with 14 additions and 1 deletions

View File

@@ -7,7 +7,7 @@
<%= <%=
page_title = title [l(:label_user_plural), users_path], @user.login page_title = title [l(:label_user_plural), users_path], @user.login
page_title.insert(page_title.rindex(' ') + 1, avatar(@user)) page_title.insert(page_title.rindex(' ') + 1, avatar(@user).to_s)
%> %>
<%= render_tabs user_settings_tabs %> <%= render_tabs user_settings_tabs %>

View File

@@ -819,6 +819,19 @@ class UsersControllerTest < Redmine::ControllerTest
assert_response 404 assert_response 404
end end
def test_update_with_blank_email_should_not_raise_exception
assert_no_difference 'User.count' do
with_settings :gravatar_enabled => '1' do
put :update, :params => {
:id => 2,
:user => {:mail => ''}
}
end
end
assert_response :success
assert_select_error /Email cannot be blank/
end
def test_destroy def test_destroy
assert_difference 'User.count', -1 do assert_difference 'User.count', -1 do
delete :destroy, :params => {:id => 2} delete :destroy, :params => {:id => 2}