Created
January 14, 2013 18:51
-
-
Save gbuesing/4532326 to your computer and use it in GitHub Desktop.
Helper to set HTTP Basic Auth in functional/controller tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper to set HTTP Basic Auth in functional/controller tests | |
# Put this in test/test_helper.rb: | |
class ActionController::TestCase | |
def login_via_http_basic_auth username, password | |
@request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(username, password) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment