Can call multiple `expects` in an `it` block without stopping on failure

Public, Testing / TDD


Created: Nov 30, 2017     Updated: Nov 30, 2017

By adding :aggregate_failures to the end of anit statement, you can call multiple expects in that it block, and if any of them fail, the tests keep testing.

For example, in the this spec, if expect(Post.count).to eq 4 fails, the test suite will continue to run through completion. Instead of stopping the running of the specs.

it "should do xyz", :aggregate_failures do
  expect(Post.count).to eq 4
  expect(User.count).to eq 2