Posted almost 8 years ago. Visible to the public.

Capybara can match elements outside of <body>

Capybara will match elements outside of a page's <body> tag.

For example, the step definitions below match <link> nodes in a page's <head>:

Copy
Then /^my browser should auto-discover the "([^"]*)" feed$/ do |slug| page.should have_css( 'head link' + '[rel="alternate"]' + "[href='http://www.example.com/#{slug}/feed.rss']" + '[title="RSS feed (all cards)"]' + '[type="application/rss+xml"]', visible: false ) end Then /^my browser should not auto-discover any RSS feeds$/ do page.should_not have_css('head link[rel="alternate"][type="application/rss+xml"]') end
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
Henning Koch
Last edit:
about 3 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 Henning Koch to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more