Sha256: 05b99ae7fd5948387b8573a80dd22d87691d69e3043c7cef3978e6dc44ef6d9e

Contents?: true

Size: 755 Bytes

Versions: 6

Compression:

Stored size: 755 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Shell, '#warn' do
  let(:input)  { StringIO.new }
  let(:output) { StringIO.new }

  subject(:shell) { TTY::Shell.new(input, output) }

  after { output.rewind }

  it 'displays one message' do
    shell.warn "Careful young apprentice!"
    expect(output.string).to eql "\e[33mCareful young apprentice!\e[0m\n"
  end

  it 'displays many messages' do
    shell.warn "Careful there!", "It's dangerous!"
    expect(output.string).to eql "\e[33mCareful there!\e[0m\n\e[33mIt's dangerous!\e[0m\n"
  end

  it 'displays message with option' do
    shell.warn "Careful young apprentice!", :newline => false
    expect(output.string).to eql "\e[33mCareful young apprentice!\e[0m"
  end

end # warn

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/shell/warn_spec.rb
tty-0.0.10 spec/tty/shell/warn_spec.rb
tty-0.0.9 spec/tty/shell/warn_spec.rb
tty-0.0.8 spec/tty/shell/warn_spec.rb
tty-0.0.7 spec/tty/shell/warn_spec.rb
tty-0.0.6 spec/tty/shell/warn_spec.rb