diff options
Diffstat (limited to 'users/test/support')
-rw-r--r-- | users/test/support/auth_test_helper.rb | 7 | ||||
-rw-r--r-- | users/test/support/stub_record_helper.rb | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/users/test/support/auth_test_helper.rb b/users/test/support/auth_test_helper.rb index f3506ae..c9f5612 100644 --- a/users/test/support/auth_test_helper.rb +++ b/users/test/support/auth_test_helper.rb @@ -1,5 +1,4 @@ module AuthTestHelper - include StubRecordHelper extend ActiveSupport::Concern # Controller will fetch current user from warden. @@ -19,10 +18,12 @@ module AuthTestHelper return @current_user 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 diff --git a/users/test/support/stub_record_helper.rb b/users/test/support/stub_record_helper.rb index 2e1a533..1be419a 100644 --- a/users/test/support/stub_record_helper.rb +++ b/users/test/support/stub_record_helper.rb @@ -39,3 +39,7 @@ module StubRecordHelper end end + +class ActionController::TestCase + include StubRecordHelper +end |