Search code examples
ruby-on-railsrspeccapybara

How to test for input title/tooltip with rspec


How do you test for an input's title/tooltip with rspec?

I wasn't testing for tooltips until I noticed a few stopped working and it wasn't caught by the other tests. (Had to add something so the question would be accepted)


Solution

  • How about:

    find('#element-locator')['title'].should == 'Expected title'