Sha256: 3209bce0e27297928e4232570d4b722c35baceaa5f638c91401979dcb52a1646

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'test_helper'
require 'honeybadger/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)
    Honeybadger::Rails.initialize
    assert_equal "RAILS LOGGER", Honeybadger.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")

    Honeybadger::Rails.initialize
    assert_equal "RAILS DEFAULT LOGGER", Honeybadger.logger
  end

  should "allow overriding of the logger if already assigned" do
    define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
    Honeybadger::Rails.initialize

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

    assert_equal "OVERRIDDEN LOGGER", Honeybadger.logger
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
honeybadger-1.8.1 test/unit/rails_test.rb
honeybadger-1.8.0 test/unit/rails_test.rb
honeybadger-1.7.0 test/unit/rails_test.rb
honeybadger-1.6.2 test/unit/rails_test.rb
honeybadger-1.6.1 test/unit/rails_test.rb
honeybadger-1.6.0 test/unit/rails_test.rb
honeybadger-1.5.0 test/unit/rails_test.rb
honeybadger-1.4.0 test/unit/rails_test.rb