# Granting should still fail
post :grant, :params => { :display_name => target_user.display_name, :role => "moderator" }
- assert_redirected_to user_path(target_user)
- assert_equal "Only administrators can perform user role management, and you are not an administrator.", flash[:error]
+ assert_redirected_to :controller => :errors, :action => :forbidden
# Login as an administrator
session[:user] = administrator_user.id
post :grant, :params => { :display_name => "non_existent_user", :role => role }
end
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Granting a role to a user that already has it should fail
# Revoking should still fail
post :revoke, :params => { :display_name => target_user.display_name, :role => "moderator" }
- assert_redirected_to user_path(target_user)
- assert_equal "Only administrators can perform user role management, and you are not an administrator.", flash[:error]
+ assert_redirected_to :controller => :errors, :action => :forbidden
# Login as an administrator
session[:user] = administrator_user.id
post :revoke, :params => { :display_name => "non_existent_user", :role => role }
end
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Removing a role from a user that doesn't have it should fail