[rspec-devel] Should all teardown blocks run regardless of error?
dan at tastapod.com
Wed Jun 27 14:39:43 EDT 2007
I agree completely. Whenever I implement or override tearDown in a junit
testcase, I use this template:
// my teardown stuff
aslak hellesoy wrote:
> Old words die hard. I meant *after* blocks, not teardown ;-)
> On 6/27/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
>> I was just bitten by some unexpected behaviour. Look at the following spec.
>> Spec::Runner.configure do |config|
>> config.after(:each) do
>> puts "C"
>> describe "examples and teardowns" do
>> it "should all run" do
>> puts "A"
>> after(:each) do
>> puts "B"
>> raise "oh no"
>> I would have expected to see:
>> But in fact I see:
>> The last (global) teardown doesn't get run - the first teardown block
>> raising an error causes the other ones to not be run at all. This
>> seems inconsistent to me - if an example fails, the (first) teardown
>> will still run.
>> I'd like to change this so that all teardowns get run, even if
>> previous ones fail (likewise for multiple setups). Does anyone have
>> any objections to that?
> rspec-devel mailing list
> rspec-devel at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-devel