Sha256: f3dc12185a9b0d32d4a5a08731e975a3751c95db2ac18759ce2feb72b1be1eea

Contents?: true

Size: 1.01 KB

Versions: 31

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path '../helper', __FILE__

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

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

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

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

    assert_equal "OVERRIDDEN LOGGER", Airbrake.logger
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
airbrakeV4rails5-4.3.8 test/rails_initializer_test.rb
airbrake-4.3.8 test/rails_initializer_test.rb
airbrake-4.3.7 test/rails_initializer_test.rb
airbrake-4.3.6 test/rails_initializer_test.rb
airbrake-4.3.5 test/rails_initializer_test.rb
airbrake-4.3.4 test/rails_initializer_test.rb
airbrake-4.3.3 test/rails_initializer_test.rb
airbrake-4.3.2 test/rails_initializer_test.rb
airbrake-4.3.1 test/rails_initializer_test.rb
airbrake-4.3.0 test/rails_initializer_test.rb
airbrake-4.2.1 test/rails_initializer_test.rb
airbrake-4.2.0 test/rails_initializer_test.rb
airbrake-4.1.0 test/rails_initializer_test.rb
airbrake-4.0.0 test/rails_initializer_test.rb
airbrake-3.2.1 test/rails_initializer_test.rb
airbrake-3.2.0 test/rails_initializer_test.rb
airbrake-3.1.17 test/rails_initializer_test.rb
airbrake-3.1.16 test/rails_initializer_test.rb
airbrake-3.1.15 test/rails_initializer_test.rb
airbrake-3.1.14 test/rails_initializer_test.rb