Sha256: b4fd9d8551db7043f1426c475cd66c04cab38dd72a5f1349866692209624ab12

Contents?: true

Size: 549 Bytes

Versions: 7

Compression:

Stored size: 549 Bytes

Contents

require_relative '../spec_helper'
require 'cliutils/ext/logger_extensions'

describe Logger do
  it 'allows custom levels to be attached' do
    l = Logger.new(STDOUT)
    l.formatter = proc do |severity, datetime, progname, msg|
      puts "#{ severity }: #{ msg }"
    end

    out = capture_stdout { l.prompt('test') }
    expect(out).to eq("PROMPT: test\n")

    out = capture_stdout { l.section('test') }
    expect(out).to eq("SECTION: test\n")

    out = capture_stdout { l.success('test') }
    expect(out).to eq("SUCCESS: test\n")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cliutils-2.2.6 spec/ext/logger_extensions_spec.rb
cliutils-2.2.5 spec/ext/logger_extensions_spec.rb
cliutils-2.2.4 spec/ext/logger_extensions_spec.rb
cliutils-2.2.3 spec/ext/logger_extensions_spec.rb
cliutils-2.2.2 spec/ext/logger_extensions_spec.rb
cliutils-2.2.1 spec/ext/logger_extensions_spec.rb
cliutils-2.2.0 spec/ext/logger_extensions_spec.rb