Sending rails errors to rspec output

可紊 提交于 2019-12-11 02:11:38

问题


I am using Capybara in combination with rspec for integration testing of rails apps.

I would like any errors (routing errors, errors in a controller, anything) generated during a test to be printed the same as "puts" statements in rspec's output. Is this possible? Additionally, is this a reasonable idea, or am I just being silly?


回答1:


Adding the following to my spec_helper.rb file worked:

ActionController::Base.class_eval do
  def rescue_action(exception)
    raise exception
  end
end


来源:https://stackoverflow.com/questions/8524839/sending-rails-errors-to-rspec-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!