Checking for the css class of the found element in capybara

Having an element like

My Text

and trying to check if the class is set to “.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.


Works just fine.