<commit_before>require 'spec/interop/test'

ActionView::Base.cache_template_extensions = false

module Spec
  module Rails
    module Example
      class RailsExampleGroup < Test::Unit::TestCase
        cattr_accessor(
          :fixture_path,
          :use_transactional_fixtures,
          :use_instantiated_fixtures,
          :global_fixtures
        )
        
        class << self
          def before_eval #:nodoc:
            super
            configure
          end
          
          def configure
            self.fixture_table_names = []
            self.fixture_class_names = {}
            self.use_transactional_fixtures = Spec::Runner.configuration.use_transactional_fixtures
            self.use_instantiated_fixtures = Spec::Runner.configuration.use_instantiated_fixtures
            self.fixture_path = Spec::Runner.configuration.fixture_path
            self.global_fixtures = Spec::Runner.configuration.global_fixtures
            self.fixtures(self.global_fixtures) if self.global_fixtures
          end
        end

        include Spec::Rails::Matchers

        @@model_id = 1000
        # Creates a mock object instance for a +model_class+ with common
        # methods stubbed out.
        # Additional methods may be easily stubbed (via add_stubs) if +stubs+ is passed.
        def mock_model(model_class, options_and_stubs = {})
          null = options_and_stubs.delete(:null_object)
          stubs = options_and_stubs
          id = @@model_id
          @@model_id += 1
          m = mock("#{model_class.name}_#{id}", :null_object => null)
          m.stub!(:id).and_return(id)
          m.stub!(:to_param).and_return(id.to_s)
          m.stub!(:new_record?).and_return(false)
          m.stub!(:errors).and_return(stub("errors", :count => 0))
          m.send(:__mock_proxy).instance_eval <<-CODE
            def @target.is_a?(other)
              #{model_class}.ancestors.include?(other)
            end
            def @target.kind_of?(other)
              #{model_class}.ancestors.include?(other)
            end
            def @target.instance_of?(other)
              other == #{model_class}
            end
            def @target.class
              #{model_class}
            end
          CODE
          add_stubs(m, stubs)
          yield m if block_given?
          m
        end
<commit_msg>just passing options_and_stubs down to the mock method from mock_model<commit_after>require 'spec/interop/test'

ActionView::Base.cache_template_extensions = false

module Spec
  module Rails
    module Example
      class RailsExampleGroup < Test::Unit::TestCase
        cattr_accessor(
          :fixture_path,
          :use_transactional_fixtures,
          :use_instantiated_fixtures,
          :global_fixtures
        )
        
        class << self
          def before_eval #:nodoc:
            super
            configure
          end
          
          def configure
            self.fixture_table_names = []
            self.fixture_class_names = {}
            self.use_transactional_fixtures = Spec::Runner.configuration.use_transactional_fixtures
            self.use_instantiated_fixtures = Spec::Runner.configuration.use_instantiated_fixtures
            self.fixture_path = Spec::Runner.configuration.fixture_path
            self.global_fixtures = Spec::Runner.configuration.global_fixtures
            self.fixtures(self.global_fixtures) if self.global_fixtures
          end
        end

        include Spec::Rails::Matchers

        @@model_id = 1000
        # Creates a mock object instance for a +model_class+ with common
        # methods stubbed out.
        # Additional methods may be easily stubbed (via add_stubs) if +stubs+ is passed.
        def mock_model(model_class, options_and_stubs = {})
          # null = options_and_stubs.delete(:null_object)
          # stubs = options_and_stubs
          id = @@model_id
          @@model_id += 1
          options_and_stubs = {
            :id => id,
            :to_param => id.to_s,
            :new_record? => false,
            :errors => stub("errors", :count => 0)
          }.merge(options_and_stubs)
          m = mock("#{model_class.name}_#{id}", options_and_stubs)
          m.send(:__mock_proxy).instance_eval <<-CODE
            def @target.is_a?(other)
              #{model_class}.ancestors.include?(other)
            end
            def @target.kind_of?(other)
              #{model_class}.ancestors.include?(other)
            end
            def @target.instance_of?(other)
              other == #{model_class}
            end
            def @target.class
              #{model_class}
            end
          CODE
          yield m if block_given?
          m
        end

{'fraction_non_alphanumeric': 0.08796100042390843, 'fraction_numerical': 0.002543450614667232, 'mean_word_length': 1.9111659469463294, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 10, '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': '4738569', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1328, 'n_words': 254}