Case insensitive Rspec match

Andrew picture Andrew · Jul 3, 2012 · Viewed 11.1k times · Source

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 can I rewrite this so that it is a case insensitive assertion?

"ALL CAPS".should include('All Caps')

Answer

prusswan picture prusswan · Jul 18, 2012

Here's improving on phoet's solution:

page.body.should match(%r{#{string}}i)

Unfortunately the syntax highlighting here isn't doing it much justice (it looks perfectly fine in Sublime Text)