summaryrefslogtreecommitdiff
path: root/users/test/functional/application_controller_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-04 17:57:03 +0100
committerAzul <azul@leap.se>2012-11-04 17:57:03 +0100
commitc0f92bf9f481463dcaef6f4b30343130a8910a00 (patch)
tree3ba89c6f38d19a7b96a0ef599b7cb6364ba5821f /users/test/functional/application_controller_test.rb
parentb92d418ebec6486a9e728c57f38f82d4c3343341 (diff)
parent19008253d01fd6d7a864e98a7ae5dc216070aee1 (diff)
Merge branch 'develop' into feature-warden-srp
Conflicts: Gemfile.lock users/app/controllers/application_controller.rb users/leap_web_users.gemspec
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