<commit_before>require File.dirname(__FILE__) + '/helper'

class RailsTest < Test::Unit::TestCase
  include DefinesConstants

  should "trigger use of Rails' logger if logger isn't set and Rails' logger exists" do
    rails = Module.new do
      def self.logger
        "RAILS LOGGER"
      end
    end
    define_constant("Rails", rails)
    HoptoadNotifier::RailsInit.new
    assert_equal "RAILS LOGGER", HoptoadNotifier.logger
  end

  should "trigger use of Rails' default logger if logger isn't set and Rails.logger doesn't exist" do
    define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")

    HoptoadNotifier::RailsInit.new
    assert_equal "RAILS DEFAULT LOGGER", HoptoadNotifier.logger
  end
end
<commit_msg>Fix test name and  add the right require<commit_after>require File.dirname(__FILE__) + '/helper'
require File.join(File.dirname(__FILE__), '..', 'lib', 'hoptoad_notifier', 'rails_init')

class RailsInitTest < Test::Unit::TestCase
  include DefinesConstants

  should "trigger use of Rails' logger if logger isn't set and Rails' logger exists" do
    rails = Module.new do
      def self.logger
        "RAILS LOGGER"
      end
    end
    define_constant("Rails", rails)
    HoptoadNotifier::RailsInit.new
    assert_equal "RAILS LOGGER", HoptoadNotifier.logger
  end

  should "trigger use of Rails' default logger if logger isn't set and Rails.logger doesn't exist" do
    define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")

    HoptoadNotifier::RailsInit.new
    assert_equal "RAILS DEFAULT LOGGER", HoptoadNotifier.logger
  end

  should "allow overriding of the logger if already assigned" do
    define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
    HoptoadNotifier::RailsInit.new

    HoptoadNotifier.configure(true) do |config|
      config.logger = "OVERRIDDEN LOGGER"
    end

    assert_equal "OVERRIDDEN LOGGER", HoptoadNotifier.logger
  end
end

{'fraction_non_alphanumeric': 0.08307210031347963, 'fraction_numerical': 0.0, 'mean_word_length': 4.093085106382978, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5413996', 'n_tokens_mistral': 624, 'n_tokens_neox': 601, 'n_words': 175}