[rspec-users] [Cucumber] Fail a scenario from After or AfterStep

Matt Wynne matt at mattwynne.net
Fri May 15 03:15:39 EDT 2009


On 15 May 2009, at 07:01, Luke Melia wrote:

> I'm trying to make sure that my cucumber selenium suite fails if my  
> Rails app returns any 500 response codes. I'm working on what the  
> best way to identify this state, but the question I'd like to put to  
> the list is this: If I want to check for this error condition in an  
> After or AfterStep, how can I force a failure in the scenario?
>
> i.e. something like the following non-functional snippet:
>
> AfterStep do |scenario|
>  if foo_error_state_detected?
>    scenario.fail("A foo failure has been detected.")
>  end
> end
>
> Ideas?

+1 to this - I came up against exactly the same problem yesterday.

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com



More information about the rspec-users mailing list