Read more

Capybara can match elements outside of <body>

Henning Koch
October 14, 2011Software engineer at makandra GmbH

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

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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

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
Posted by Henning Koch to makandra dev (2011-10-14 11:30)