diff options
Diffstat (limited to 'test/controllers/users_controller_test.rb')
| -rw-r--r-- | test/controllers/users_controller_test.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index dcd8f259..67f7c053 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | require 'test_helper' | 1 | require 'test_helper' |
| 2 | 2 | ||
| 3 | class UsersControllerTest < ActionController::TestCase | 3 | class UsersControllerTest < ActionController::TestCase |
| 4 | 4 | ||
| 5 | test "get index as regular user renders stripped partial" do | 5 | test "get index as regular user renders stripped partial" do |
| 6 | login_as :quentin | 6 | login_as :quentin |
| 7 | get :index | 7 | get :index |
| @@ -16,20 +16,20 @@ class UsersControllerTest < ActionController::TestCase | |||
| 16 | assert_select "button[type=submit]", I18n.t("admin.common.destroy") | 16 | assert_select "button[type=submit]", I18n.t("admin.common.destroy") |
| 17 | assert_select "a", "show" | 17 | assert_select "a", "show" |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | test "get new when logged in as admin" do | 20 | test "get new when logged in as admin" do |
| 21 | login_as :aaron | 21 | login_as :aaron |
| 22 | get :new | 22 | get :new |
| 23 | assert_response :success | 23 | assert_response :success |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | test "get new without being logged in as admin redirects back to index" do | 26 | test "get new without being logged in as admin redirects back to index" do |
| 27 | login_as :quentin | 27 | login_as :quentin |
| 28 | get :new | 28 | get :new |
| 29 | assert_response :redirect | 29 | assert_response :redirect |
| 30 | assert_redirected_to users_path | 30 | assert_redirected_to users_path |
| 31 | assert_equal( | 31 | assert_equal( |
| 32 | "Sorry, you need to be an admin for this action", | 32 | I18n.t("flash.common.admin_required"), |
| 33 | flash[:notice] | 33 | flash[:notice] |
| 34 | ) | 34 | ) |
| 35 | end | 35 | end |
| @@ -84,7 +84,7 @@ class UsersControllerTest < ActionController::TestCase | |||
| 84 | 84 | ||
| 85 | assert_redirected_to users_path | 85 | assert_redirected_to users_path |
| 86 | assert_equal( | 86 | assert_equal( |
| 87 | "Sorry, you need to be an admin for this action", | 87 | I18n.t("flash.common.admin_required"), |
| 88 | flash[:notice] | 88 | flash[:notice] |
| 89 | ) | 89 | ) |
| 90 | end | 90 | end |
| @@ -94,7 +94,7 @@ class UsersControllerTest < ActionController::TestCase | |||
| 94 | get :edit, params: { :id => User.find_by_login("aaron").id } | 94 | get :edit, params: { :id => User.find_by_login("aaron").id } |
| 95 | assert_redirected_to users_path | 95 | assert_redirected_to users_path |
| 96 | assert_equal( | 96 | assert_equal( |
| 97 | "Sorry, you need to be an admin for this action", | 97 | I18n.t("flash.common.admin_required"), |
| 98 | flash[:notice] | 98 | flash[:notice] |
| 99 | ) | 99 | ) |
| 100 | end | 100 | end |
| @@ -117,7 +117,7 @@ class UsersControllerTest < ActionController::TestCase | |||
| 117 | put :update, params: { :id => user.id, :user => {:login => "random"} } | 117 | put :update, params: { :id => user.id, :user => {:login => "random"} } |
| 118 | assert_redirected_to users_path | 118 | assert_redirected_to users_path |
| 119 | assert_equal( | 119 | assert_equal( |
| 120 | "Sorry, you need to be an admin for this action", | 120 | I18n.t("flash.common.admin_required"), |
| 121 | flash[:notice] | 121 | flash[:notice] |
| 122 | ) | 122 | ) |
| 123 | end | 123 | end |
| @@ -137,7 +137,7 @@ class UsersControllerTest < ActionController::TestCase | |||
| 137 | assert_redirected_to user_path(user) | 137 | assert_redirected_to user_path(user) |
| 138 | assert_equal "random", user.reload.login | 138 | assert_equal "random", user.reload.login |
| 139 | end | 139 | end |
| 140 | 140 | ||
| 141 | test "showing a user" do | 141 | test "showing a user" do |
| 142 | login_as :quentin | 142 | login_as :quentin |
| 143 | get :show, params: { :id => User.find_by_login("aaron").id } | 143 | get :show, params: { :id => User.find_by_login("aaron").id } |
| @@ -151,7 +151,7 @@ class UsersControllerTest < ActionController::TestCase | |||
| 151 | end | 151 | end |
| 152 | assert_redirected_to users_path | 152 | assert_redirected_to users_path |
| 153 | assert_equal( | 153 | assert_equal( |
| 154 | "Sorry, you need to be an admin for this action", | 154 | I18n.t("flash.common.admin_required"), |
| 155 | flash[:notice] | 155 | flash[:notice] |
| 156 | ) | 156 | ) |
| 157 | end | 157 | end |
