<commit_before>require 'action_dispatch'
require 'webrat'

module ControllerExampleGroupBehaviour
  include ActionDispatch::Assertions
  include ActionDispatch::Integration::Runner
  include Webrat::Matchers
  include Webrat::Methods
  include Rspec::Rails::Matchers

  def self.included(mod)
    mod.before do
      @_result = Struct.new(:add_assertion).new
    end
  end

  def app 
    self.class.described_class.action(@_action).tap do |endpoint|
      def endpoint.routes
        Rails.application.routes
      end
    end
  end

  %w[get post put delete head].map do |method|
    eval <<-CODE
      def #{method}(*args)
        @_action = args.shift
        super '/', *args
      end
    CODE
  end

  Rspec.configure do |c|
    c.include self, :example_group => { :file_path => /\bspec\/controllers\// }
  end
end<commit_msg>use described_class on the example<commit_after>require 'action_dispatch'
require 'webrat'

module ControllerExampleGroupBehaviour
  include ActionDispatch::Assertions
  include ActionDispatch::Integration::Runner
  include Webrat::Matchers
  include Webrat::Methods
  include Rspec::Rails::Matchers

  def self.included(mod)
    mod.before do
      @_result = Struct.new(:add_assertion).new
    end
  end

  def app 
    described_class.action(@_action).tap do |endpoint|
      def endpoint.routes
        Rails.application.routes
      end
    end
  end

  %w[get post put delete head].map do |method|
    eval <<-CODE
      def #{method}(*args)
        @_action = args.shift
        super '/', *args
      end
    CODE
  end

  Rspec.configure do |c|
    c.include self, :example_group => { :file_path => /\bspec\/controllers\// }
  end
end
{'fraction_non_alphanumeric': 0.1026252983293556, 'fraction_numerical': 0.0, 'mean_word_length': 3.0215827338129495, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4549698', 'n_tokens_mistral': 538, 'n_tokens_neox': 520, 'n_words': 129}