Sha256: e2332dcf33251f48f7644e7d85d6640bb0c1d01b56ca8924d43286982b9c503c

Contents?: true

Size: 635 Bytes

Versions: 5

Compression:

Stored size: 635 Bytes

Contents

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

require 'spec_helper'

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

  it 'reads multiple lines' do
    input << "First line\nSecond line\nThird line"
    input.rewind
    q = shell.ask("Provide description?")
    expect(q.read_multiple).to eql "First line\nSecond line\nThird line"
  end

  it 'skips empty lines' do
    input << "First line\n\nSecond line"
    input.rewind
    q = shell.ask("Provide description?")
    expect(q.read_multiple).to eql "First line\nSecond line"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/shell/response/read_multiple_spec.rb
tty-0.0.10 spec/tty/shell/response/read_multiple_spec.rb
tty-0.0.9 spec/tty/shell/response/read_multiple_spec.rb
tty-0.0.8 spec/tty/shell/response/read_multiple_spec.rb
tty-0.0.7 spec/tty/shell/response/read_multiple_spec.rb