summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-11-12 10:42:07 -0800
committerjessib <jessib@riseup.net>2012-11-12 10:42:07 -0800
commit67cb22d50193a58e4697549d9ce8a22e790a7a0d (patch)
tree5b4f27ff3e47fade97afec78618cfdddf2bd6931 /users/test
parent90af08d51eb24202bd703bfdfa1d2811fa26a5e0 (diff)
some notes to test that aren't working now.
Diffstat (limited to 'users/test')
-rw-r--r--users/test/functional/application_controller_test.rb4
-rw-r--r--users/test/support/auth_test_helper.rb7
2 files changed, 7 insertions, 4 deletions
diff --git a/users/test/functional/application_controller_test.rb b/users/test/functional/application_controller_test.rb
index 69bcb2f..b228b1d 100644
--- a/users/test/functional/application_controller_test.rb
+++ b/users/test/functional/application_controller_test.rb
@@ -8,9 +8,9 @@ class ApplicationControllerTest < ActionController::TestCase
end
def test_authorize_redirect
- stub_logged_out
+ stub_logged_out #broken?
@controller.send(:authorize)
- assert_access_denied
+ assert_access_denied(true, false)
end
def test_authorized
diff --git a/users/test/support/auth_test_helper.rb b/users/test/support/auth_test_helper.rb
index 9412058..37aef34 100644
--- a/users/test/support/auth_test_helper.rb
+++ b/users/test/support/auth_test_helper.rb
@@ -9,15 +9,18 @@ module AuthTestHelper
end
def stub_logged_out
+ #todo: this seems wrong.
@user_id = stub
session[:user_id] = @user_id
User.expects(:find).once.with(@user_id).returns(nil)
end
- def assert_access_denied(denied = true)
+ def assert_access_denied(denied = true, logged_in = true)
if denied
assert_equal({:alert => "Not authorized"}, flash.to_hash)
- assert_redirected_to login_path
+ # todo: eventually probably eliminate separate conditions
+ assert_redirected_to login_path if !logged_in
+ assert_redirected_to root_path if logged_in
else
assert flash[:alert].blank?
end