<commit_before>begin
  require 'capybara/rails'
  require 'capybara/cucumber'
rescue LoadError
end

module Cucumber
  module Rails
    module World
      def visit(*)
        if defined?(super)
          super
        else
          raise Cucumber::Pending, "Capybara not loaded, please add it to your Gemfile:\n\ngem \"capybara\"\n\n"
        end
      end
    end
  end
end

World(Cucumber::Rails::World)
<commit_msg>Allow user to control show_exceptions in tests<commit_after>begin
  require 'capybara/rails'
  require 'capybara/cucumber'
rescue LoadError
end

module Cucumber
  module Rails
    module World
      def visit(*)
        if defined?(super)
          super
        else
          raise Cucumber::Pending, "Capybara not loaded, please add it to your Gemfile:\n\ngem \"capybara\"\n\n"
        end
      end
    end
  end
end

World(Cucumber::Rails::World)

ActionController::Base.class_eval do
  cattr_accessor :allow_rescue
end

ActionDispatch::ShowExceptions.class_eval do
  alias __cucumber_orig_call__ call

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

Before('@allow-rescue') do
  @__orig_allow_rescue = ActionController::Base.allow_rescue
  ActionController::Base.allow_rescue = true
end

After('@allow-rescue') do
  ActionController::Base.allow_rescue = @__orig_allow_rescue
end
{'fraction_non_alphanumeric': 0.08589835361488905, 'fraction_numerical': 0.0, 'mean_word_length': 3.4380952380952383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2719270', 'n_tokens_mistral': 467, 'n_tokens_neox': 465, 'n_words': 111}