Sha256: fbadd10e1399448cd513b6d9a0f153bbfd13bad2126597a1b7c578b0fdd82bba

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

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

class Reality::TestLogging < Reality::TestCase

  module MyModule
  end

  def test_basic_operation
    io = StringIO.new('', 'w')
    Reality::Logging.configure(MyModule, io)

    assert_true MyModule::Logger.is_a?(::Logger)

    MyModule.debug('Debug output')

    assert_equal io.string, ''

    MyModule.info('Info output')

    assert_equal io.string, "Info output\n"

    MyModule.warn('Warn output')

    assert_equal io.string, "Info output\nWarn output\n"

    assert_raise(RuntimeError) { MyModule.error('Error output') }

    assert_equal io.string, "Info output\nWarn output\nError output\n"

    MyModule::Logger.level = ::Logger::DEBUG

    MyModule.debug('Debug output')

    assert_equal io.string, "Info output\nWarn output\nError output\nDebug output\n"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reality-core-1.1.0 test/test_logging.rb
reality-core-1.0.0 test/test_logging.rb