Posted about 9 years ago. Visible to the public.

Test meta-refresh redirects with Cucumber

The step definition below allows you to write:

Copy
Then I should see an HTML redirect to "http://www.makandracards.com" in the page head

Capybara

Copy
Then /^I should see an HTML redirect to "([^\"]*)" in the page head$/ do |redirect_url| page.should have_xpath("//meta[@http-equiv=\"refresh\" and contains(@content, \"#{redirect_url}\")]") end

To find meta tags with Capybara, you can also use page.find('meta', visible: false).

Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Avatar
Dominik Schöler
Last edit:
almost 6 years ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more