Sha256: d54c5ac6941e081f08d16b787b73c8615a59cba124f11e5192ad6bd96435f41d

Contents?: true

Size: 791 Bytes

Versions: 11

Compression:

Stored size: 791 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Logger, '#new' do
  let(:object) { described_class }
  let(:output) { StringIO.new }

  subject(:logger) { object.new(options) }

  context 'when default' do
    let(:options) { {namespace: ''} }

    it { expect(logger.level).to eq(object::ALL) }

    it { expect(logger.output).to eq($stderr) }

    it { expect(logger.timestamp_format).to eq('%Y-%m-%d %T') }
  end

  context 'when custom' do
    let(:options) { {
      namespace: 'tty::color',
      level: 2,
      output: output,
      timestamp_format: "%dd" } }

    it { expect(logger.namespace).to eq('tty::color') }

    it { expect(logger.level).to eq(2) }

    it { expect(logger.output).to eq(output) }

    it { expect(logger.timestamp_format).to eq('%dd') }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tty-0.5.0 spec/tty/logger/new_spec.rb
tty-0.4.0 spec/tty/logger/new_spec.rb
tty-0.3.2 spec/tty/logger/new_spec.rb
tty-0.3.1 spec/tty/logger/new_spec.rb
tty-0.3.0 spec/tty/logger/new_spec.rb
tty-0.2.1 spec/tty/logger/new_spec.rb
tty-0.2.0 spec/tty/logger/new_spec.rb
tty-0.1.3 spec/tty/logger/new_spec.rb
tty-0.1.2 spec/tty/logger/new_spec.rb
tty-0.1.1 spec/tty/logger/new_spec.rb
tty-0.1.0 spec/tty/logger/new_spec.rb