summaryrefslogtreecommitdiff
path: root/users/test/functional/application_controller_test.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-11-02 11:12:15 -0700
committerjessib <jessib@riseup.net>2012-11-02 11:12:15 -0700
commit4db41d772725387ba36240cf8f3529780e896755 (patch)
tree4c4e0f7651ee100f93273775ec934dba1a934724 /users/test/functional/application_controller_test.rb
parent8b5f7fb6ef438ef034541d6fb500b5ab7e12f3f2 (diff)
parent872b9fa6759d5708f5efb19ba46b3c8e2b5d4862 (diff)
Merge branch 'feature-admin_users' into help_develop
Diffstat (limited to 'users/test/functional/application_controller_test.rb')
-rw-r--r--users/test/functional/application_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/users/test/functional/application_controller_test.rb b/users/test/functional/application_controller_test.rb
new file mode 100644
index 0000000..69bcb2f
--- /dev/null
+++ b/users/test/functional/application_controller_test.rb
@@ -0,0 +1,29 @@
+require 'test_helper'
+
+class ApplicationControllerTest < ActionController::TestCase
+
+ def setup
+ # so we can test the effect on the response
+ @controller.response = @response
+ end
+
+ def test_authorize_redirect
+ stub_logged_out
+ @controller.send(:authorize)
+ assert_access_denied
+ end
+
+ def test_authorized
+ @user = stub_logged_in
+ @controller.send(:authorize)
+ assert_access_denied(false)
+ end
+
+ def test_authorize_admin
+ @user = stub_logged_in
+ @user.expects(:is_admin?).returns(false)
+ @controller.send(:authorize_admin)
+ assert_access_denied
+ end
+
+end