ActionController::Base.class_eval do
  cattr_accessor :allow_rescue
end

class ActionDispatch::ShowExceptions
  alias __cucumber_orig_call__ call

  def call(env)
    env['action_dispatch.show_exceptions'] = !!ActionController::Base.allow_rescue
    env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
    __cucumber_orig_call__(env)
  end
end

ActionController::Base.class_eval do
  cattr_accessor :allow_rescue
end

class ActionDispatch::ShowExceptions
  alias __cucumber_orig_call__ call

  def call(env)
    env['action_dispatch.show_exceptions'] = !!ActionController::Base.allow_rescue
    if Rails.version >= "3.2.1"
      env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
    end
    __cucumber_orig_call__(env)
  end
end

Make check conditional to Rails version
Make check conditional to Rails version

This PR depends on action_dispatch.show_detailed_exceptions being set,
which was only introduced in Rails 3.2.1.

Here we introduce a conditional check based on the required Rails
version in order to ensure backwards compatibility.
