Rails rspec integration_tests and http authentication

I use Rspec 2 and capybara and define a basic integration test, i.e.

describe "EeRequisitions" do describe "GET /ee_requisitions" do it "works! (now write some real specs)" do get ee_requisitions_path response.status.should be(200) end end end 

Since the application uses basic HTTP authentication, and since capybara says it includes Rack :: Test, I expected to add the line:

 authorize 'user', 'password' 

will handle this (since then I lost the stackoverflow post that told me about this). Unfortunately, this did not happen - he continued to throw a "method not found" error. I finally found a solution in the commentary on this post: Rails / Rspec Make tests pass using http basic authentication , where Matt Connelly pointed me to this point: https://gist.github.com/mattconnolly/4158961 , which finally solved my problem .

However, I'm still wondering why the Rack :: Test approach failed, as it seems to have worked for others.

+4
source share
1 answer

Does the string include

 include Rack::Test::Methods 

at the top of the test matter?

0
source

All Articles