<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>ruby on rails blog - Latest Comments in Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://rubyonrailsblog.disqus.com/</link><description></description><atom:link href="https://rubyonrailsblog.disqus.com/testing_with_basic_http_authentication_in_rails_20_ruby_on_rails_blog/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Sun, 15 Feb 2009 04:53:53 -0000</lastBuildDate><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-6272679</link><description>&lt;p&gt;Instead of using Base64 directly, it's better to use:&lt;/p&gt;&lt;p&gt;ActionController::HttpAuthentication::Basic.encode_credentials('username', 'password')&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">joost</dc:creator><pubDate>Sun, 15 Feb 2009 04:53:53 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-3247430</link><description>&lt;p&gt;This was just what I needed!&lt;/p&gt;&lt;p&gt;Like unit testing you can do&lt;/p&gt;&lt;p&gt;def setup&lt;br&gt;http_auth&lt;br&gt;end&lt;/p&gt;&lt;p&gt;so all your test methods are authenticated.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jantzen Owens</dc:creator><pubDate>Thu, 23 Oct 2008 01:47:55 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907419</link><description>&lt;p&gt;A few months late, I found this via the Google. A couple notes:&lt;/p&gt;&lt;p&gt;In case you're unfamiliar with testing Rails, this goes in test/test_helper.rb&lt;/p&gt;&lt;p&gt;The function above doesn't actually let you test HTTP Authentication. To do that you'll need to do something like:&lt;/p&gt;&lt;p&gt;    def authenticate_with_http(username, password)&lt;br&gt;      @request.env[”HTTP_AUTHORIZATION”] =&lt;br&gt;      "Basic #{Base64.encode64("#{username}:#{password}")}"&lt;br&gt;    end&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ryan Cannon</dc:creator><pubDate>Mon, 21 Jul 2008 02:47:48 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907418</link><description>&lt;p&gt;thanks for this. helped in our functional tests of our REST services using http basic auth.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">robert</dc:creator><pubDate>Tue, 06 May 2008 12:46:35 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907414</link><description>&lt;p&gt;Ahh, yes!  I've been looking for this too.  Thanks!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lane</dc:creator><pubDate>Thu, 28 Feb 2008 19:12:58 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907417</link><description>&lt;p&gt;It's always kind of cool when random people read your blog and you can help them :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan</dc:creator><pubDate>Tue, 19 Feb 2008 21:20:17 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907416</link><description>&lt;p&gt;Thanks! Finally made my tests work..&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Diego</dc:creator><pubDate>Tue, 19 Feb 2008 20:48:34 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907413</link><description>&lt;p&gt;Ce n'est pas un problème! (That's my year of Français I took coming out)&lt;/p&gt;&lt;p&gt;I definitely spent too much time trying to figure this out...it's the simple things that are always a pain!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan</dc:creator><pubDate>Thu, 17 Jan 2008 06:06:52 -0000</pubDate></item><item><title>Re: Testing with Basic HTTP Authentication in Rails 2.0 | ruby on rails blog</title><link>http://www.jonathansng.com/ruby-on-rails/testing-with-basic-http-authentication-in-rails-20/#comment-1907412</link><description>&lt;p&gt;Thanks for the tip. You just saved me couple of hours of fighting with the tests.&lt;/p&gt;&lt;p&gt;Take Care.&lt;/p&gt;&lt;p&gt;Hugues&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hugues Lamy</dc:creator><pubDate>Fri, 11 Jan 2008 15:39:43 -0000</pubDate></item></channel></rss>