Sha256: be508dccab296146dbca76d52552153c0c2516652dfc1d7dd03382cd3629888b

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Shell, '#error' 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.error "Nothing is fine!"
    expect(output.string).to eql "\e[31mNothing is fine!\e[0m\n"
  end

  it 'displays many messages' do
    shell.error "Nothing is fine!", "All is broken!"
    expect(output.string).to eql "\e[31mNothing is fine!\e[0m\n\e[31mAll is broken!\e[0m\n"
  end

  it 'displays message with option' do
    shell.error "Nothing is fine!", :newline => false
    expect(output.string).to eql "\e[31mNothing is fine!\e[0m"
  end
end # error

Version data entries

1 entries across 1 versions & 1 rubygems

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