4

I am using Rspec 2 and capybara and defined the 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 app uses HTTP basic authentication and since capybara says it includes Rack::Test, I expected that adding the line:

authorize 'user', 'password'

would handle it (I've since lost the stackoverflow post that told me that). Unfortunately it didn't - it kept throwing a 'method not found' error. I finally found the solution in a comment to this post: Rails/Rspec Make tests pass with http basic authentication where Matt Connelly pointed me to this gist: 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.

1 Answer 1

0

Does including the line

include Rack::Test::Methods

at the top of the tests make a difference?

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, no. And not only does that test still fail, but all the other tests in that group now fail as well with the message: undefined local variable or method `app' for #<EeRequisitionMailer:0x000000049293a8>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.