Sha256: f38eb49958e06510890be2e6f1378e2312e3bb802cd37f469b04bbde0b615352

Contents?: true

Size: 1.08 KB

Versions: 55

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path('../test_helper', __FILE__)

describe "Backburner::Logger module" do
  include Backburner::Logger

  before do
    @strio = StringIO.new
    @logger = Logger.new(@strio)
  end

  describe "for log_info method" do
    it "prints out to std out" do
      output = capture_stdout { log_info("foo") }
      assert_equal "foo\n", output
    end

    it "can be configured to log to logger" do
      Backburner.configure { |config| config.logger = @logger }
      log_info("foo")
      assert_match(/I,.*?foo/, @strio.string)
    end

    after do
      Backburner.configure { |config| config.logger = nil }
    end
  end # log_info

  describe "for log_error method" do
    it "prints out to std err" do
      output = capture_stdout { log_error("bar") }
      assert_equal "bar\n", output
    end

    it "can be configured to log to logger" do
      Backburner.configure { |config| config.logger = @logger }
      log_error("bar")
      assert_match(/E,.*?bar/, @strio.string)
    end

    after do
      Backburner.configure { |config| config.logger = nil }
    end
  end # log_error
end

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
backburner-allq-1.0.50 test/logger_test.rb
backburner-allq-1.0.49 test/logger_test.rb
backburner-allq-1.0.48 test/logger_test.rb
backburner-1.6.1 test/logger_test.rb
backburner-allq-1.0.47 test/logger_test.rb
backburner-allq-1.0.46 test/logger_test.rb
backburner-allq-1.0.45 test/logger_test.rb
backburner-allq-1.0.44 test/logger_test.rb
backburner-allq-1.0.40 test/logger_test.rb
backburner-allq-1.0.39 test/logger_test.rb
backburner-allq-1.0.38 test/logger_test.rb
backburner-allq-1.0.37 test/logger_test.rb
backburner-allq-1.0.36 test/logger_test.rb
backburner-1.6.0 test/logger_test.rb
backburner-allq-1.0.35 test/logger_test.rb
backburner-allq-1.0.34 test/logger_test.rb
backburner-allq-1.0.33 test/logger_test.rb
backburner-allq-1.0.32 test/logger_test.rb
backburner-allq-1.0.31 test/logger_test.rb
backburner-allq-1.0.29 test/logger_test.rb