Sha256: b78c46bb4323426002666b990b04357e4008c9723fa95d409587f59c811b1478
Contents?: true
Size: 613 Bytes
Versions: 5
Compression:
Stored size: 613 Bytes
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe TTY::Shell::Question, '#read_range' do let(:input) { StringIO.new } let(:output) { StringIO.new } let(:shell) { TTY::Shell.new(input, output) } subject { input << value input.rewind shell.ask("Which age group?").read_range } context 'with valid range' do let(:value) { "20-30" } it { expect(subject).to be_kind_of Range } it { expect(subject).to eql (20..30) } end context 'with invalid range' do let(:value) { "abcd" } it { expect { subject }.to raise_error(ArgumentError) } end end # read_range
Version data entries
5 entries across 5 versions & 1 rubygems