Regexes are supported by Capybara has_content?
Problem
I am trying to assert the presence of a button on the page by checking the button text:
expect(page).to have_content("Close")
Unfortunately, the page also has a dropdown that contains the option Closed
.
Solution
Regex to the rescue!
expect(page).to have_content(/Close\b/)
Written on October 4, 2017 by clemenspark