Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rails exceptions to show using capybara and selenium

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?

like image 582
calstad Avatar asked Jan 07 '11 16:01

calstad


2 Answers

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.

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
like image 53
Matt Kent Avatar answered Oct 12 '22 12:10

Matt Kent


Matt's solution didn't work for me, but precisely this gist https://gist.github.com/1443408 did.

https://github.com/thoughtbot/capybara-webkit/issues/226 explains in more detail why it happens and provides explanation on what given gist does.

like image 41
EdvardM Avatar answered Oct 12 '22 13:10

EdvardM