Community Page
- jonathansng.com Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- the most keyword tools are not bad, but the hardest thing is to find the keys where brings the money.
- I am looking for American Engravers, Alliance Ohio. the phone number 214-748-3647 is on a Local search for American Engravers???? Tom Park
- Thanks!!
- This seems to do the job: ((Time.now.to_time - birthday.to_time) / 1.years).to_i
- Thanks a lot!!!!
Jump to original thread »
Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog
Started by ngng · 10 months ago
1 year ago
Take Care.
Hugues
1 year ago
I definitely spent too much time trying to figure this out...it's the simple things that are always a pain!
1 year ago
Regards
1 year ago
1 year ago
1 year ago
11 months ago
In case you're unfamiliar with testing Rails, this goes in test/test_helper.rb
The function above doesn't actually let you test HTTP Authentication. To do that you'll need to do something like:
def authenticate_with_http(username, password)
@request.env[”HTTP_AUTHORIZATION”] =
"Basic #{Base64.encode64("#{username}:#{password}")}"
end
8 months ago
Like unit testing you can do
def setup
http_auth
end
so all your test methods are authenticated.
4 months ago
ActionController::HttpAuthentication::Basic.encode_credentials('username', 'password')