[rspec-users] re -raise exceptions in stories?

Ben Mabey ben at benmabey.com
Thu Jan 24 17:53:28 EST 2008


Neil M. Young wrote:
> I see that rails handles exceptions in stories by rendering public/500.html,
> whereas in controller specs exceptions are re-raised. Is it possible to have
> this same behaviour in stories so I can check the correct exceptions are
> being raised?
>   
I do this by putting the following in my helper.rb:

ActionController::Base.class_eval do
  def perform_action
    perform_action_without_rescue
  end
end

Dispatcher.class_eval do
  def self.failsafe_response(output, status, exception = nil)
    raise exception
  end
end


More information about the rspec-users mailing list