title: how to force a cucumber scenario to fail?
body: <p>Is there a way to force a cucumber scenario to fail?</p>
  
  <p>I need to check for a few failing scenarios at the end of each of my tests. So I thought I could do the check for an 'error' dialog and then fail the test if it occurred.</p>
  
  <p>This is possible with the code below however there is a problem. Once I raise the exception in the fail! function, then cucumber stops running the rest of the After hook, so the logout function doesnt get called.</p>
  
  <p>Was:</p>
  
  <pre><code>After() do |scenario|  
    #Checking for Error popups
    if page.has_selector?(:dialog_message, 1, :text =&gt; 'Error')
      fail!(raise(ArgumentError.new('Unexpected Error dialog!')))
    end
    logout
  end
  </code></pre>
  
  <p>Now:</p>
  
  <pre><code>After() do |scenario|  
    #Checking for Error popups
    if page.has_selector?(:dialog_message, 1, :text =&gt; 'Error')
      scenario.fail!(logout)
    end
  end
  </code></pre>
  
  <p>Is there a better way to fail a cucumber test without raising an exception?</p>