Created
June 4, 2013 15:45
-
-
Save SebAshton/5706958 to your computer and use it in GitHub Desktop.
Cucumber Steps for HTTP Redirection. Only tested using Capybara's default driver (RackTest)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Feature: HTTP redirects | |
# Scenario: 301 redirect | |
# When I visit the path "<old_path>" | |
# Then I should get a response with status 301 | |
# And the url path should be "<new_path>" | |
Then /^I should get a response with status (\d+)$/ do |status| | |
assert @response.status.should == status | |
end | |
Then /^the url path should be "(.*?)"$/ do |path| | |
assert page.current_path == path, | |
"#{page.current_path} != #{path}" | |
end | |
When /^I visit the path "(.*?)"$/ do |path| | |
current_driver = Capybara.current_session.driver | |
@response = current_driver.get path | |
visit "#{path}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment