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.
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
Well, I am using SauceOnDemand with rspec. So when a test fails I want
to download the video that corresponds to the failing test. I figured
I could do a:
it "should download video" do
begin
#some failing test here
rescue Exception => e
#download video
raise e
end
end
But this would get very repetitive for every rspec test.
On Apr 29, 7:31?pm, Pat Maddox <mailingli... at patmaddox.com>
wrote:> 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-us... at rubyforge.org
> >http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at
rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>
> --
> You received this message because you are subscribed to the Google Groups
"rspec" group.
> To post to this group, send email to rspec at googlegroups.com.
> To unsubscribe from this group, send email to rspec+unsubscribe at
googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/rspec?hl=en.
Ryan S wrote:> Well, I am using SauceOnDemand with rspec. So when a test fails I want > to download the video that corresponds to the failing test. I figured > I could do a: > > it "should download video" do > begin > #some failing test here > rescue Exception => e > #download video > raise e > end > end > > But this would get very repetitive for every rspec test. >Have you investigated creating a custom formatter? I think that approach might be better suited for what you are doing. It has been a while since I''ve dug into that code but I imagine that the exception will be passed to you for inspection. If that doesn''t suit your needs you will have to decorate ''it'' on ExampleGroup. -Ben> > On Apr 29, 7:31 pm, Pat Maddox <mailingli... at patmaddox.com> wrote: > >> 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-us... at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users >> >> -- >> You received this message because you are subscribed to the Google Groups "rspec" group. >> To post to this group, send email to rspec at googlegroups.com. >> To unsubscribe from this group, send email to rspec+unsubscribe at googlegroups.com. >> For more options, visit this group athttp://groups.google.com/group/rspec?hl=en. >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >