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

ruby_version_is "2.3" do
  describe "Module#deprecate_constant" do
    before :each do
      @module = Module.new
      @value = :value
      @module::PUBLIC1 = @value
      @module::PUBLIC2 = @value
      @module::PRIVATE = @value
      @module.private_constant :PRIVATE
      @pattern = /deprecated/
    end
    
    describe "when accessing the deprecated module" do
      it "passes the accessing" do
        @module.deprecate_constant :PUBLIC1

        @module::PUBLIC1.should equal(@value)
        lambda { @module::PRIVATE }.should raise_error(NameError)
      end
      
      it "warns with a message" do
        @module.deprecate_constant :PUBLIC1

        lambda { @module::PUBLIC1 }.should complain(@pattern)
        lambda { @module.const_get :PUBLIC1 }.should complain(@pattern)<commit_msg>Fix Module#deprecate_constant for private constants<commit_after>require File.expand_path('../../../spec_helper', __FILE__)

ruby_version_is "2.3" do
  describe "Module#deprecate_constant" do
    before :each do
      @module = Module.new
      @value = :value
      @module::PUBLIC1 = @value
      @module::PUBLIC2 = @value
      @module::PRIVATE = @value
      @module.private_constant :PRIVATE
      @module.deprecate_constant :PRIVATE
      @pattern = /deprecated/
    end
    
    describe "when accessing the deprecated module" do
      it "passes the accessing" do
        @module.deprecate_constant :PUBLIC1

        @module::PUBLIC1.should equal(@value)
        lambda { @module::PRIVATE }.should raise_error(NameError)
      end
      
      it "warns with a message" do
        @module.deprecate_constant :PUBLIC1

        lambda { @module::PUBLIC1 }.should complain(@pattern)
        lambda { @module.const_get :PRIVATE }.should complain(@pattern)
{'fraction_non_alphanumeric': 0.1088139281828074, 'fraction_numerical': 0.009249183895538629, 'mean_word_length': 2.8472803347280333, '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': '3090164', 'n_tokens_mistral': 574, 'n_tokens_neox': 549, 'n_words': 135}