[rspec-users] Running code on error

Ryan S musicmanryan at gmail.com
Wed Apr 28 16:51:42 EDT 2010


describe "Test" do
  after(:each) do
      if ERRORS #execute custom code here
  end

  it "should explode" do
    #Test.explode --> "fizzle"
    Test.explode.should == "KABOOM"
  end
end

Let's say I have the above test and the validation fails and I want
some sort of custom action to take place. Is there a way to do that?
This is a very simplified example but I am just curious if it is
possible.


More information about the rspec-users mailing list