ruby on rails - HTTP basic auth for Capybara -


i'm writing rspec tests rails 3 application , trying switch webrat capybara. far application uses http basic auth authorize admin user, idea how can test capybara?

here current webrat step:

it 'should authenticate admin'   basic_auth('user', 'secret')   visit '/admin'   response.status.should eql 200   response.status.should_not eql 401 end 

how do capybara? thanks!

i got work using page.driver.basic_authorize(name, password) instead

update:

at moment, after capybara upgrade, i'm using pile of workarounds:

if page.driver.respond_to?(:basic_auth)   page.driver.basic_auth(name, password) elsif page.driver.respond_to?(:basic_authorize)   page.driver.basic_authorize(name, password) elsif page.driver.respond_to?(:browser) && page.driver.browser.respond_to?(:basic_authorize)   page.driver.browser.basic_authorize(name, password) else   raise "i don't know how log in!" end 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -