]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/user_roles_controller_test.rb
Merge remote-tracking branch 'upstream/pull/2225'
[rails.git] / test / controllers / user_roles_controller_test.rb
index 705f06a1c469e281122e1f0ecfd80fe1f0093d37..ba3d795def64bc4f1d4a1cd47f8f331ad844dda6 100644 (file)
@@ -31,8 +31,7 @@ class UserRolesControllerTest < ActionController::TestCase
 
     # 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
@@ -43,7 +42,7 @@ class UserRolesControllerTest < ActionController::TestCase
         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
@@ -92,8 +91,7 @@ class UserRolesControllerTest < ActionController::TestCase
 
     # 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
@@ -104,7 +102,7 @@ class UserRolesControllerTest < ActionController::TestCase
         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