I\'m writing a Capybara test and using Rspec for the assertions. My test is failing because there is a CSS style being applied that is causing the text to be in all caps. How ca
Also, if you are using Capybara, you can use the have_content
matcher which is case insensitive:
ALL CAPS
find('h1').should have_content('All Caps')
Update: I guess I was partly wrong. Consider this:
Title Case
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.