diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index c3dde992..13ee8db6 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -36,7 +36,7 @@ class UsersControllerTest < ActionController::TestCase assert_equal assigns['users'],[User.where(:login => 'jane').first] end - def test_destroy_user + def test_destroy_user_as_admin login_as :admin_user @no_users_before = User.count user_id = users(:ldap_user).id @@ -44,8 +44,16 @@ class UsersControllerTest < ActionController::TestCase assert_equal @no_users_before-1, User.count end + def test_destroy_user_as_user + login_as :other_user + @no_users_before = User.count + user_id = users(:other_user).id + post :destroy, xhr: true, params: { :id => user_id.to_param } + assert_equal @no_users_before-1, User.count + end + def test_update_password_successful - get :change_password, params: { :id => users(:admin_user).id } + get :change_password, params: { :id => users(:admin_user).id } # should fail because no login assert_redirected_to login_path login_as :admin_user