Sha256: b680f4a80a4770a776ad327dd4357c328c53775f67224f1d8e68c9bb42a5eefb

Contents?: true

Size: 1015 Bytes

Versions: 2

Compression:

Stored size: 1015 Bytes

Contents

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

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

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

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

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

    assert_equal "OVERRIDDEN LOGGER", Pulse.logger
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
projectlocker_pulse-1.0.0 test/rails_initializer_test.rb
projectlocker_pulse-0.2.1 test/rails_initializer_test.rb