Sha256: bb990ab5824b886e42e5c975f5f4405f07eb87a8f589c4daa5ef8ff071268f4d

Contents?: true

Size: 436 Bytes

Versions: 5

Compression:

Stored size: 436 Bytes

Contents

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

require 'spec_helper'

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

  it 'reads string' do
    name = "Piotr"
    input << name
    input.rewind
    q = shell.ask("What is your name?")
    answer = q.read_string
    expect(answer).to be_kind_of String
    expect(answer).to eql name
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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