<commit_before>require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")

module RR
  module DoubleDefinitions
    describe DoubleDefinitionCreatorProxy do
      attr_reader :space, :subject, :creator, :the_proxy
      it_should_behave_like "Swapped Space"

      before(:each) do
        @subject = Object.new
        @creator = DoubleDefinitionCreator.new
        creator.mock
      end

      class << self
        define_method("initializes proxy with passed in creator") do
          it "initializes proxy with passed in creator" do
            class << the_proxy
              attr_reader :creator
            end
            the_proxy.creator.should === creator
          end
        end
      end

      describe ".new" do
        it "does not undefine object_id" do
          the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
          the_proxy.object_id.class.should == Fixnum
        end

        context "without block" do
          before do
            @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
          end

          send "initializes proxy with passed in creator"

          it "clears out all methods from proxy" do
            proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
              def i_should_be_a_double
              end
            end
            proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')

            proxy = proxy_subclass.new(creator, subject)
            proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
          end
        end

        context "with block" do
          before do
            @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject) do |b|
              b.foobar(1, 2) {:one_two}
              b.foobar(1) {:one}
              b.foobar.with_any_args {:default}
              b.baz() {:baz_result}
            end
          end

          # send "initializes proxy with passed in creator"

          it "creates double_injections" do<commit_msg>Readded commented-out specs.<commit_after>require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")

module RR
  module DoubleDefinitions
    describe DoubleDefinitionCreatorProxy do
      attr_reader :space, :subject, :creator, :the_proxy
      it_should_behave_like "Swapped Space"

      before(:each) do
        @subject = Object.new
        @creator = DoubleDefinitionCreator.new
        creator.mock
      end

      class << self
        define_method("initializes proxy with passed in creator") do
          it "initializes proxy with passed in creator" do
            class << the_proxy
              attr_reader :creator
            end
            the_proxy.creator.should === creator
          end
        end
      end

      describe ".new" do
        it "does not undefine object_id" do
          the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
          the_proxy.object_id.class.should == Fixnum
        end

        context "without block" do
          before do
            @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
          end

          send "initializes proxy with passed in creator"

          it "clears out all methods from proxy" do
            proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
              def i_should_be_a_double
              end
            end
            proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')

            proxy = proxy_subclass.new(creator, subject)
            proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
          end
        end

        context "with block" do
          before do
            @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject) do |b|
              b.foobar(1, 2) {:one_two}
              b.foobar(1) {:one}
              b.foobar.with_any_args {:default}
              b.baz() {:baz_result}
            end
          end

          send "initializes proxy with passed in creator"

          it "creates double_injections" do
{'fraction_non_alphanumeric': 0.07232164746261338, 'fraction_numerical': 0.0014709487619514587, 'mean_word_length': 1.960812772133527, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2404541', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1094, 'n_words': 287}