Exceptions in Rails controllers do not cause a backtrace in RSpec #358

notahat opened this Issue May 24, 2011 · 6 comments

5 participants


When using Capybara with RSpec and rack-test, Rails catches exceptions thrown by controllers, and you end up running your Capybara matchers against the Rails error page. This makes errors very hard to track down. (Assuming your spec fails, you need to do a save_and_open_page to read the error.)

This is easily fixed by putting the following in a file in spec/support:

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

I think this should be the default behaviour, but it's not clear where it should live. Should it be part of RSpec? Part of Capybara?

Cucumber gets around the question by having the cucumber-rails gem, and putting some similar code in there.

Any thoughts?


Duplicate or related: #329


I don't think #329 is related.


#508 looks like a duplicate one though.


That's really something for Rails or rspec-rails or whatever to handle. This is not really Capybara's business, imo.

@jnicklas jnicklas closed this Jan 3, 2012

@jnicklas totally agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment