Revoking administrator role on current user should fail

Fixes #1697
Closes #1701
This commit is contained in:
mmd-osm 2017-12-19 17:31:34 +00:00 committed by Tom Hughes
parent 965123372d
commit e21c967fdd
3 changed files with 12 additions and 1 deletions

View file

@ -134,5 +134,10 @@ class UserRolesControllerTest < ActionController::TestCase
end
assert_redirected_to user_path(target_user.display_name)
assert_equal "The string `no_such_role' is not a valid role.", flash[:error]
# Revoking administrator role from current user should fail
post :revoke, :params => { :display_name => administrator_user.display_name, :role => "administrator" }
assert_redirected_to user_path(administrator_user.display_name)
assert_equal "Cannot revoke administrator role from current user.", flash[:error]
end
end