<commit_before>require 'spec'
module Kernel
  def given(*args, &example_group_block)
    args << {} unless Hash === args.last
    params = args.last
    
    params[:shared] = true
    
    describe(*args) do
      before(:each) do
        self.instance_eval(&example_group_block)
      end
    end
  end  
end

module Spec
  module Matchers
    def fail
      raise_error(Spec::Expectations::ExpectationNotMetError)
    end

    def fail_with(message)
      raise_error(Spec::Expectations::ExpectationNotMetError, message)
    end
  end
end

module Merb
  module Test
    def self.add_helpers(&block)
      if Merb.test_framework == :rspec
        ExampleGroup.class_eval(&block)
      else
        raise NotImplementedError
      end
    end

    class ExampleGroup < Spec::Example::ExampleGroup

      include ::Merb::Test::ViewHelper
      include ::Merb::Test::RouteHelper
      include ::Merb::Test::ControllerHelper

      def initialize(defined_description, &implementation)
        @_defined_description = defined_description
        @_implementation = implementation
      end

      class << self
        # This is a copy of the method in rspec, so we can have
        # describe "...", :when => "logged in", and the like
        def describe(*args, &example_group_block)
          args << {} unless Hash === args.last
          if example_group_block
            params = args.last
            params[:spec_path] = eval("caller(0)[1]", example_group_block) unless params[:spec_path]
            if params[:shared]
              ::Spec::Example::SharedExampleGroup.new(*args, &example_group_block)
            else
              self.subclass("Subclass") do
                describe(*args)
                if params[:when] || (params[:when] = params[:given])
                  module_eval %{it_should_behave_like "#{params[:when]}"}
                end
                module_eval(&example_group_block)
              end
            end
          else
            set_description(*args)
            before_eval
            self
          end
        end
        alias context describe
<commit_msg>Changes rspec addition to use super instead of copying everything<commit_after>require 'spec'
module Kernel
  def given(*args, &example_group_block)
    args << {} unless Hash === args.last
    params = args.last
    
    params[:shared] = true
    
    describe(*args) do
      before(:each) do
        self.instance_eval(&example_group_block)
      end
    end
  end  
end

module Spec
  module Matchers
    def fail
      raise_error(Spec::Expectations::ExpectationNotMetError)
    end

    def fail_with(message)
      raise_error(Spec::Expectations::ExpectationNotMetError, message)
    end
  end
end

module Merb
  module Test
    def self.add_helpers(&block)
      if Merb.test_framework == :rspec
        ExampleGroup.class_eval(&block)
      else
        raise NotImplementedError
      end
    end

    class ExampleGroup < Spec::Example::ExampleGroup

      include ::Merb::Test::ViewHelper
      include ::Merb::Test::RouteHelper
      include ::Merb::Test::ControllerHelper

      def initialize(defined_description, &implementation)
        @_defined_description = defined_description
        @_implementation = implementation
      end

      class << self
        # This is a copy of the method in rspec, so we can have
        # describe "...", :when => "logged in", and the like
        def describe(*args, &example_group_block)
          super
          params ||= {}
          if example_group_block && params[:when] || (params[:when] = params[:given])
            module_eval %{it_should_behave_like "#{params[:when]}"}
          end
        end
        alias context describe

{'fraction_non_alphanumeric': 0.09174311926605505, 'fraction_numerical': 0.0005396654074473826, 'mean_word_length': 2.3638838475499093, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '5883145', 'n_tokens_mistral': 1024, 'n_tokens_neox': 999, 'n_words': 257}