Cucumber + Capybara show rails exceptions
Posted: February 8, 2012 Filed under: Uncategorized 1 Comment »Whenever there is an exception that is raised in Rails, Capybara will show only a blank page on the simulated browser. It becomes quite difficult to find out what went wrong. To get the exception on your console while running the test, just this patch to your features/support/env.rb.
#If your running mongrel
Capybara.server do |app, port|
require 'rack/handler/mongrel'
Rack::Handler::Mongrel.run(app, : Port => port)
end
#If your are running thin
module Thin::Logging
def log_error(e=$!)
STDERR.print "#{e}\n\t" + e.backtrace.join("\n\t")
end
end
Happy testing.
I faced the exact same problem and couldn’t figure out what went wrong for a very long time. Thanks for the nice tip.