From 67cb22d50193a58e4697549d9ce8a22e790a7a0d Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 12 Nov 2012 10:42:07 -0800 Subject: some notes to test that aren't working now. --- users/test/support/auth_test_helper.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'users/test/support/auth_test_helper.rb') 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 -- cgit v1.2.3