If you have content inside a page that is hidden by CSS, the following will work with Selenium, but not when using the Rack::Test driver. The Selenium driver correctly only considers text that is actually visible to a user.
Then I should not see "foobear"
This is because the Rack::Test driver does not know if an element is visible, and only looks at the DOM.
Spreewald Show archive.org snapshot offers steps to check that an element is hidden by CSS:
Then "foo" should be hidden
You can also check that an element is visible:
Then "foo" should be visible
hidden
or style="display: none"
attribute. In a Rack::Test scenario the step will not recognize if the element is hidden via another CSS class.