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?
Apparently you can select elements with a given text:
Note: I used a regular expression to make the text search case insensitive.