Skip to content

Instantly share code, notes, and snippets.

@shuhei
Created October 16, 2013 06:03
Show Gist options
  • Save shuhei/7003263 to your computer and use it in GitHub Desktop.
Save shuhei/7003263 to your computer and use it in GitHub Desktop.
Assert number of elements with Capybara. Let's say we are testing a page whose JS adds elements step by step...
# Bad
expect(all('.something').size).to eq(5)
# Good
expect(page).to have_css('.something', count: 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment