<commit_before>require File.expand_path('../../spec_helper', __FILE__)

# Language-level method behaviour
describe "Redefining a method" do
  it "replaces the original method" do
    def barfoo; 100; end
    barfoo.should == 100

    def barfoo; 200; end
    barfoo.should == 200
  end
end

describe "Defining an 'initialize' method" do
  it "sets the method's visibility to private" do
    class DefInitializeSpec
      def initialize
      end
    end
    DefInitializeSpec.should have_private_instance_method(:initialize, false)
  end
end

describe "Defining an 'initialize_copy' method" do
  it "sets the method's visibility to private" do
    class DefInitializeCopySpec
      def initialize_copy
      end
    end
    DefInitializeCopySpec.should have_private_instance_method(:initialize_copy, false)
  end
end

ruby_version_is "2.0" do
  describe "Defining an 'initialize_dup' method" do
    it "sets the method's visibility to private" do
      class DefInitializeDupSpec
        def initialize_dup
        end
      end
      DefInitializeDupSpec.should have_private_instance_method(:initialize_dup, false)
    end
  end
end

describe "An instance method definition with a splat" do
  it "accepts an unnamed '*' argument" do
    def foo(*); end;

    foo.should == nil<commit_msg>Add a spec for defining `initialize_clone` from 2.0<commit_after>require File.expand_path('../../spec_helper', __FILE__)

# Language-level method behaviour
describe "Redefining a method" do
  it "replaces the original method" do
    def barfoo; 100; end
    barfoo.should == 100

    def barfoo; 200; end
    barfoo.should == 200
  end
end

describe "Defining an 'initialize' method" do
  it "sets the method's visibility to private" do
    class DefInitializeSpec
      def initialize
      end
    end
    DefInitializeSpec.should have_private_instance_method(:initialize, false)
  end
end

describe "Defining an 'initialize_copy' method" do
  it "sets the method's visibility to private" do
    class DefInitializeCopySpec
      def initialize_copy
      end
    end
    DefInitializeCopySpec.should have_private_instance_method(:initialize_copy, false)
  end
end

ruby_version_is "2.0" do
  describe "Defining an 'initialize_dup' method" do
    it "sets the method's visibility to private" do
      class DefInitializeDupSpec
        def initialize_dup
        end
      end
      DefInitializeDupSpec.should have_private_instance_method(:initialize_dup, false)
    end
  end

  describe "Defining an 'initialize_clone' method" do
    it "sets the method's visibility to private" do
      class DefInitializeCloneSpec
        def initialize_clone
        end
      end
      DefInitializeCloneSpec.should have_private_instance_method(:initialize_clone, false)
    end
  end
end

describe "An instance method definition with a splat" do
  it "accepts an unnamed '*' argument" do
    def foo(*); end;

    foo.should == nil
{'fraction_non_alphanumeric': 0.0634866163349348, 'fraction_numerical': 0.01029512697323267, 'mean_word_length': 3.430091185410334, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4512630', 'n_tokens_mistral': 872, 'n_tokens_neox': 834, 'n_words': 291}