Today I Learned

Using have_selector with css and exact: option

Using have_selector with css selector and exact: option basically does not work.


expect(page).to_not have_content('a.hidden', exact: 'Push pricing to CB')


The :exact option only has an effect on queries using the XPath#is method. Using it with the query "div.hidden" has no effect.

We can use :contains("") css selector though!

expect(page).to_not have_content('a.hidden:contains("Push pricing to CB")')