Sha256: d88a61b7298ae67cb0a8dbf7303a01aaadb3453217f6ff90826205c92083c9dd

Contents?: true

Size: 489 Bytes

Versions: 6

Compression:

Stored size: 489 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'reads date' do
    input << "20th April 1887"
    input.rewind
    q = shell.ask("When were your born?")
    answer = q.read_date
    expect(answer).to be_kind_of Date
    expect(answer.day).to eql 20
    expect(answer.month).to eql 4
    expect(answer.year).to eql 1887
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-0.2.1 spec/tty/shell/response/read_date_spec.rb
tty-0.2.0 spec/tty/shell/response/read_date_spec.rb
tty-0.1.3 spec/tty/shell/response/read_date_spec.rb
tty-0.1.2 spec/tty/shell/response/read_date_spec.rb
tty-0.1.1 spec/tty/shell/response/read_date_spec.rb
tty-0.1.0 spec/tty/shell/response/read_date_spec.rb