summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-07-11 11:14:43 -0700
committerjessib <jessib@leap.se>2013-07-11 11:14:43 -0700
commitcc83a756affe1cedd6d828f038632b36e8afe95c (patch)
treebf6d9255ee9709d1504832a61c8918e7ac5cc9bb /users/test
parent09b7f01cac6df1ae11f4129b20b781b78a3706ac (diff)
parent02b69c78eed7682c24cb8361da094bdac45a7749 (diff)
Merge branch 'master' into feature/authentication_generic_error
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 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