rspec-rails (2.7.0) rails (3.0.10) post: Rails 3.1 Error Catching is irrelevant for me.
Code:
class ApplicationController < ActionController::Base
You also need to set Rails.application.config.action_dispatch.show_exceptions = true
. But since Rails caches that value, this will only work if you run your spec on its own. Fortunately, you can change these options only for the current spec by mocking the config:
before do
method = Rails.application.method(:env_config)
expect(Rails.application).to receive(:env_config).with(no_args) do
method.call.merge(
"action_dispatch.show_exceptions" => true,
"action_dispatch.show_detailed_exceptions" => false,
"consider_all_requests_local" => false
)
end
end
Thanks to: