summaryrefslogtreecommitdiff
path: root/test/support/auth_test_helper.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-06-09 11:00:28 +0200
committerAzul <azul@leap.se>2014-06-09 11:00:28 +0200
commit728d6d3985126c2890638bb2ee24020fa0e36a80 (patch)
tree1fcbb560b0103123d49fb953e86fdb960ee5dd13 /test/support/auth_test_helper.rb
parentb9174fdc9d9bd403d9a16650bafc4715e3dbf2d4 (diff)
parent9fa52ed80d71ec56ed5acf18dfd63bd03b201cc5 (diff)
Merge tag '0.5.2'
Diffstat (limited to 'test/support/auth_test_helper.rb')
-rw-r--r--test/support/auth_test_helper.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/support/auth_test_helper.rb b/test/support/auth_test_helper.rb
index 57f9f9b..38c2ea1 100644
--- a/test/support/auth_test_helper.rb
+++ b/test/support/auth_test_helper.rb
@@ -19,6 +19,10 @@ module AuthTestHelper
return @current_user
end
+ def assert_login_required
+ assert_access_denied(true, false)
+ end
+
def assert_access_denied(denied = true, logged_in = true)
if denied
if @response.content_type == 'application/json'
@@ -46,8 +50,9 @@ module AuthTestHelper
protected
def header_for_token_auth
- @token = find_record(:token, :authenticate => @current_user)
- ActionController::HttpAuthentication::Token.encode_credentials @token.id
+ @token = stub_record(:token, :authenticate => @current_user)
+ Token.stubs(:find_by_token).with(@token.token).returns(@token)
+ ActionController::HttpAuthentication::Token.encode_credentials @token.token
end
def expect_warden_logout