Today I Learned

hashrocket A Hashrocket project

Assert No Selector

Capybara assertions can be very simple. Today I learned about the assert_no_selector and assert_selector methods.

Then 'assert_no_selector works' do
  assert_no_selector '.nonexistent-text'

Then 'assert_selector works' do
  assert_selector '.existent-text'

And here's the view that makes them pass:

# app/views/home/index.html.haml

No RSpec required!

See More #testing TILs