diff options
Diffstat (limited to 'users/test')
-rw-r--r-- | users/test/functional/users_controller_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/users/test/functional/users_controller_test.rb b/users/test/functional/users_controller_test.rb index 92a5f6c..0ce5cc2 100644 --- a/users/test/functional/users_controller_test.rb +++ b/users/test/functional/users_controller_test.rb @@ -142,4 +142,22 @@ class UsersControllerTest < ActionController::TestCase assert assigns(:users) end + test "user cannot enable own account" do + user = find_record :user + login + post :enable, :id => user.id + assert_access_denied + end + + test "admin can deactivate user" do + user = find_record :user + assert user.enabled? + user.expects(:save).returns(true) + + login :is_admin? => true + + post :deactivate, :id => user.id + assert !assigns(:user).enabled? + end + end |