Sha256: 8189e0b9c2437d2af15d7390028dcff49596d9febd290eb0d4fa4241fdf134c8

Contents?: true

Size: 825 Bytes

Versions: 3

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

ActionController::Base.class_eval do
  cattr_accessor :allow_rescue
end

module Cucumber
  module Rails
    module ActionDispatch
      module ShowExceptions
        def call(env)
          env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue

          show_exceptions = !env['action_dispatch.show_detailed_exceptions']
          if ::Rails.gem_version >= Gem::Version.new('7.1.0')
            # Rails 7.1 deprecated `show_exceptions` boolean in in favor of symbols
            show_exceptions = show_exceptions ? :all : :none
          end

          env['action_dispatch.show_exceptions'] = show_exceptions
          super(env)
        end
      end
    end
  end
end

ActionDispatch::ShowExceptions.prepend(Cucumber::Rails::ActionDispatch::ShowExceptions)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-rails-3.1.0 lib/cucumber/rails/action_dispatch.rb
cucumber-rails-3.0.1 lib/cucumber/rails/action_dispatch.rb
cucumber-rails-3.0.0 lib/cucumber/rails/action_dispatch.rb