Terminate on first failure?

We have thousands of code examples (‘it’ methods) in each of our rspec
files, each of which is dependent upon the success of the previous one.
These are wrapped in a few example groups (‘desc’ methods).

There’s no changing that; that’s the way they were written.

We are making significant changes to the code base, and the tests are
failing. They are also taking a huge amount of time failing each of the
successive code examples.

Is there any way to get RSpec to terminate upon the first failure?

Thanks,
Pete

On Tue, Feb 9, 2010 at 12:10 PM, Erik N. [email protected] wrote:

Is there any way to get RSpec to terminate upon the first failure?
There’s no way that I’m aware of to do this in rspec-1. There will
likely be a way to do it in rspec-2, but not yet (some of the
necessary pieces aren’t in place). Once we get there, you’ll be able
to do something like:

purely hypothetical code - do not try this at home

Rspec::Core.configure do |c|
c.after(:each) do
if running_example.metadata[:status] == ‘failed’
running_example.example_group.break
end
end
end

Coming soon, but not quite yet.

Cheers,
David

David C. wrote:

purely hypothetical code - do not try this at home

Rspec::Core.configure do |c|
c.after(:each) do
if running_example.metadata[:status] == ‘failed’
running_example.example_group.break
end
end
end

Coming soon, but not quite yet.

Very cool.

Thanks,
Pete