Skip to content

Commit

Permalink
Updated authorize method
Browse files Browse the repository at this point in the history
  • Loading branch information
jayzes committed Oct 4, 2011
1 parent 5b65887 commit 0af9d99
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/cucumber/api_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
end

When /^I authenticate as the user "([^"]*)" with the password "([^"]*)"$/ do |user, pass|
page.driver.authorize(user, pass)
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)
elsif page.driver.respond_to?(:authorize)
page.driver.authorize(user, pass)
else
raise "I don't know how to log in!"
end
end

When /^I send a (GET|POST|PUT|DELETE) request (?:for|to) "([^"]*)" (?:with the following:)?$/ do |request_type, path, body|
Expand Down

0 comments on commit 0af9d99

Please sign in to comment.