Sha256: 1540bf4145856be7d9e512bd8be4fc95c14d2ecca5bcf47b4ccae2de30495cce

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 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

1 entries across 1 versions & 1 rubygems

Version Path
tty-0.1.0 spec/tty/shell/warn_spec.rb