Imagine you’re running your whole RSpec test suite and the first or second test fails. You have about two hundred tests to go, but you want to dive in and fix that first failure right away. You’d probably interrupt the run to get the failure details to go fix them, right? While this works most of the time (you might get some problems interrupting the run when using Selenium) wouldn’t it be awesome if RSpec could automatically stop and output when running into the first failure?

The fail_fast configuration I started poking around in the RSpec source and accidentally stumbled on RSpec’s generated documentation on Relish, where I found the fail_fast configuration option that got introduced in rspec-core 2.0.0.rc. It actually does exactly what I wanted to achieve. The fail_fast option will cause RSpec to immediately stop running your specs and output the failure details whenever it fails for the first time, giving you a nice speed boost when trying to fix some spec fails. RSpec.configure do |c| c.fail_fast = true end