summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-07-04 13:20:24 -0700
committerjessib <jessib@leap.se>2013-07-04 13:20:24 -0700
commitcfb9e1d4c2e954222b77c4dd11e06ae3a0092be5 (patch)
tree74d9faa47f54d456319b875ee787364acbdb94c3 /users/test
parentb1a7a700d214508bce1ddd13d80191c309ca17c5 (diff)
Add tests for enabling/deactivating.
Diffstat (limited to 'users/test')
-rw-r--r--users/test/functional/users_controller_test.rb18
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 7f81c59..9964df5 100644
--- a/users/test/functional/users_controller_test.rb
+++ b/users/test/functional/users_controller_test.rb
@@ -205,4 +205,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