Sha256: 3f57fc8741d4f3fdfa243ac38cb5618301f83d77b71d6bc3ef01d044114e2b08

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require 'assert'
require 'ostruct'
require 'logging'
require 'logsly/settings'
require 'logsly/stdout_output'

class Logsly::StdoutOutput

  class BaseTests < Assert::Context
    desc "the StdoutOutput handler"
    setup do
      @logger = OpenStruct.new
      @logger.debug_level = :white
      @logger.pattern = '%d : %m\n'

      Logsly.colors('a_color_scheme') do |logger|
        debug logger.debug_level
      end

      @out = Logsly::StdoutOutput.new do |logger|
        pattern logger.pattern
        colors  'a_color_scheme'
      end
    end
    subject { @out }

    should "be an output handler" do
      assert_kind_of Logsly::BaseOutput, subject
    end

    should "build a Logging stdout appender, passing args to the builds" do
      appender = subject.to_appender @logger

      assert_kind_of Logging::Appenders::Stdout, appender
      assert_kind_of Logging::Layouts::Pattern,  appender.layout
      assert_equal   '%d : %m\n',                appender.layout.pattern
      assert_kind_of Logging::ColorScheme,       appender.layout.color_scheme
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logsly-1.0.2 test/unit/stdout_output_tests.rb
logsly-1.0.1 test/unit/stdout_output_tests.rb
logsly-1.0.0 test/unit/stdout_output_tests.rb
logsly-1.0.0.rc1 test/unit/stdout_output_tests.rb