Sha256: 3f85ef11d5a6bbed1176eadac10adafaa53faf0f654d27e426a72dc17debc8fd

Contents?: true

Size: 1.07 KB

Versions: 35

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/helper'

require 'hoptoad_notifier/rails'

class RailsInitializerTest < 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::Rails.initialize
    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::Rails.initialize
    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::Rails.initialize

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

    assert_equal "OVERRIDDEN LOGGER", HoptoadNotifier.logger
  end
end

Version data entries

35 entries across 35 versions & 6 rubygems

Version Path
hoptoad_notifier-2.3.6 test/rails_initializer_test.rb
hoptoad_notifier-2.3.5 test/rails_initializer_test.rb
hoptoad_notifier-2.3.4 test/rails_initializer_test.rb
hoptoad_notifier-2.3.3 test/rails_initializer_test.rb
hoptoad_notifier-2.3.2 test/rails_initializer_test.rb
jordan-brough-hoptoad_notifier-2.3.0 test/rails_initializer_test.rb
hoptoad_notifier-2.3.0 test/rails_initializer_test.rb
hatless-hoptoad_notifier-2.2.6.1 test/rails_initializer_test.rb
hatless-hoptoad_notifier-2.2.6.001 test/rails_initializer_test.rb
hatless-hoptoad_notifier-2.2.6 test/rails_initializer_test.rb
hoptoad_notifier-2.2.6 test/rails_initializer_test.rb
hoptoad_notifier-2.2.5 test/rails_initializer_test.rb
hoptoad_notifier-2.2.2 test/rails_initializer_test.rb
errornot_notifier-0.1.0 test/rails_initializer_test.rb
hoptoad_notifier-2.2.0 test/rails_initializer_test.rb