Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Capybara is missing webrat's header method #17

Closed
jnicklas opened this Issue · 9 comments

7 participants

@jnicklas
Owner

Need to figure out exactly how the Webrat version works.

@jnicklas
Owner

Closing this for the time being, I just don't think it's possible on non rack-test drivers.

@rishav

can we provide it only for the rack:test driver ?

@jnicklas
Owner

It seems to have become a standard that behaviours which are not common for all drivers need to be run through page.driver, such as page.driver.get, etc… This is already possible with headers, through page.driver.request.headers. Not the pretties API, and maybe we should shorten it to page.driver.headers, but other than that, it's already possible.

I urge everyone to avoid using this though, this is going to lock you into using the RackTest driver. Which is also why I don't want to provide a high level API for it, to really drive home that you're doing something potentially problematic.

@Papipo

But for http authentication this makes a lot of sense, don't you think?

@jnicklas
Owner

Not all drivers support http authentication. So I don't think it makes sense to lull people into thinking that they have a working setup, only to have their tests fail once they switch driver. It is possible to do basic auth in Capybara (search the mailing list!), it's not easy though, and that's a good thing, imho.

It's all about encouraging good practices.

@paul

I know this issue is closed, I just wanted to add another use-case: shared cookie auth. We have several apps, but the login form is only on one, which sets a domain cookie that is read by the other apps. With the Rack driver, the specs in the other apps can't #visit another app to fill out the login form, and get the cookie set. I have to manually set the cookie (or an rack env setting).

@movingelectrons

so... has anyone settled on a driver(s) that do support http basic auth and forked and got this working? I don't get if every single driver works with http basic auth, just as long as one of them works.

@jaimeiniesta

Adding another use-case: simulated HTTP_ACCEPT_LANGUAGE.

I've tried setting it through page.driver.request.env["HTTP_ACCEPT_LANGUAGE"] but it doesn't seem to work.

@nicholaides

Can we revisit this?

In the specs, we already have:

it_should_behave_like "session"
it_should_behave_like "session without javascript support"
it_should_behave_like "session with headers support"
it_should_behave_like "session with status code support"

Why not have?:

it_should_behave_like "session with HTTP Basic Auth support"

... it's not easy though, and that's a good thing, imho. It's all about encouraging good practices.

I disagree with this. HTTP Auth, including Basic Auth, has appropriate use cases.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.