Also, if you are using Capybara, you can use the have_content
matcher which is case insensitive:
<h1>ALL CAPS</h1>
find('h1').should have_content('All Caps')
Update: I guess I was partly wrong. Consider this:
<h1 style="text-transform: uppercase">Title Case</h1>
puts find('h1').text
# TITLE CASE < notice all caps
puts find('h1').has_content?('Title Case') # true
puts find('h1').has_content?('TITLE CASE') # false
puts find('h1').has_content?('title case') # false
It's strange to me that the text returned is in all caps (how it's styled after CSS), but the matcher is actually testing against the text in the unstyled HTML. I spent a while digging through the source code and I still can't figure out why this works.