<commit_before>module Spec
  module Api
    class Mock
      # Remove all methods so they can be mocked too
      (public_instance_methods - ['__id__', '__send__', 'nil?']).each do |m|
        undef_method m
      end

      # Creates a new mock with a +name+ (that will be used in error messages only)
      # Options:
      # * <tt>:null_object</tt> - if true, the mock object acts as a forgiving null object allowing any message to be sent to it.
      def initialize(name, options={})
        @name = name
        @options = DEFAULT_OPTIONS.dup.merge(options)
        @expectations = []
        @expectation_ordering = OrderGroup.new
      end
      
      def should_receive(sym, &block)
        expected_from = caller(1)[0]
        expectation = MessageExpectation.new(@name, @expectation_ordering, expected_from, sym, block_given? ? block : nil)
        @expectations << expectation
        expectation
      end
      
      def should_not_receive(sym, &block)
        expected_from = caller(1)[0]
        expectation = NegativeMessageExpectation.new(@name, @expectation_ordering, expected_from, sym, block_given? ? block : nil)
        @expectations << expectation
        expectation<commit_msg>removed some duplication related to mock.should_not_receive<commit_after>module Spec
  module Api
    class Mock
      # Remove all methods so they can be mocked too
      (public_instance_methods - ['__id__', '__send__', 'nil?']).each do |m|
        undef_method m
      end

      # Creates a new mock with a +name+ (that will be used in error messages only)
      # Options:
      # * <tt>:null_object</tt> - if true, the mock object acts as a forgiving null object allowing any message to be sent to it.
      def initialize(name, options={})
        @name = name
        @options = DEFAULT_OPTIONS.dup.merge(options)
        @expectations = []
        @expectation_ordering = OrderGroup.new
      end
      
      def should_receive(sym, &block)
        add MessageExpectation, caller(1)[0], sym, &block
      end
      
      def should_not_receive(sym, &block)
        add NegativeMessageExpectation, caller(1)[0], sym, &block
      end
      
      def add(klass, expected_from, sym, &block)
        expectation = klass.send(:new, @name, @expectation_ordering, expected_from, sym, block_given? ? block : nil)
        @expectations << expectation
        expectation
{'fraction_non_alphanumeric': 0.092094196804037, 'fraction_numerical': 0.00336417157275021, 'mean_word_length': 2.6656394453004624, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4905063', 'n_tokens_mistral': 681, 'n_tokens_neox': 669, 'n_words': 214}