获取Rails异常以使用水豚和硒进行显示 [英] Get rails exceptions to show using capybara and selenium
问题描述
在使用capybara和selenium在rails中运行集成测试时,如果引发异常,则会显示空白白页,而不是通常的带有堆栈跟踪的异常屏幕。有没有办法让水豚显示堆栈跟踪页面?
In using capybara and selenium to run integration tests in rails, if an exception is raised a blank white page is shown instead of the usual exception screen with the stack trace. Is there a way to get capybara to show the stack trace pages?
推荐答案
我无法显示堆栈跟踪页面使用Webrick或Thin,但我最终的解决方法是使用Mongrel,它可以将堆栈跟踪信息正确打印到stderr。
I was not able to get the stack traces to show with Webrick or Thin, but my eventual workaround was to use Mongrel, which properly prints the stack traces to stderr.
使用capybara 0.4.1.2或更高版本,您可以配置capybara像这样使用杂种:
With capybara 0.4.1.2 or later, you can configure capybara to use mongrel like so:
Capybara.server do |app, port|
require 'rack/handler/mongrel'
Rack::Handler::Mongrel.run(app, :Port => port)
end
这篇关于获取Rails异常以使用水豚和硒进行显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!