Capybara: How to check that an element has content among many similar elements?

Viewed 8850

I need to check that some content exists on the page within a specific type of selector. For example, let's say I have the following HTML:

<h2>HEADLINE ONE</h2>
<h2>HEADLINE TWO</h2>

I know how to select only the first one on the page:

find('h2').should have_content('Headline Two')  # have_content is also case insensitive

How would I check that the content exists among all of the h2s on the page?

1 Answers
Related