[rspec-users] [cucumber] How to add a after failure hook?

aidy lewis aidy.lewis at googlemail.com
Thu Apr 2 12:31:21 EDT 2009


Hi Tim,

I have used a custom formatter, if this is any help

class ExceptionFormatter < Cucumber::Ast::Visitor
	
def initialize(step_mother, io, options)
   super(step_mother)
 end
	
def visit_feature_name(name)
  if name =~ /Feature:\s(.*)/i
    @name = $1
  else
    @name = name
  end
end

def visit_exception(exception, status)
  exception_file = "#{File.dirname(__FILE__)}/#{@name}.html"
  open(exception_file, 'w') { |f| f << browser.html }
 end
end

Aidy

On 01/04/2009, Tim Harper <timcharper at gmail.com> wrote:
> Is currently a way to add a upon failure hook?  I'd like to make it so that,
> in the event of a failed assertion, Webrat will take the last requested page
> and open it in a browser.
>
> Thanks :)
>
> Tim
> _______________________________________________
>  rspec-users mailing list
>  rspec-users at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list