Having an element like
My Text
and trying to check if the class is set to “.some-class”
page.find("#some-id").has_css?(".some-class")
does not work in capybara. This is due to the fact that #has_css? checks for
the css being available inside the element not on the element itself. But is
it still easy to check it by accessing the attributes hash.
page.find("#some-id")[:class].include?("some-class")
Works just fine.