[rspec-users] Running code on error

Pat Maddox mailinglists at patmaddox.com
Thu Apr 29 20:31:53 EDT 2010


Could you share a bit more about what you are actually trying to achieve?


On Apr 28, 2010, at 1:51 PM, Ryan S wrote:

> 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.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list