Sha256: 43ebecc1ad409d6855487c644ff3a12fb9fbab4e97555aa451c69f6f5b00c597
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# encoding: utf-8 require 'spec_helper' describe TTY::Coercer::Range, '#coerce' do subject { described_class.coerce(value) } context 'with empty' do let(:value) { '' } it { expect { subject }.to raise_error(TTY::InvalidArgument) } end context 'with 1' do let(:value) { '1' } it { is_expected.to eq(1..1) } end context 'with 1..10' do let(:value) { '1..10' } it { is_expected.to eq(1..10) } end context 'with 1-10' do let(:value) { '1-10' } it { is_expected.to eq(1..10) } end context 'with 1,10' do let(:value) { '1,10' } it { is_expected.to eq(1..10) } end context 'with 1...10' do let(:value) { '1...10'} it { is_expected.to eq(1...10) } end context 'with -1..10' do let(:value) { '-1..10' } it { is_expected.to eq(-1..10) } end context 'with 1..-10' do let(:value) { '1..-10' } it { is_expected.to eq(1..-10) } end context 'with a..z' do let(:value) { 'a..z' } it { is_expected.to eq('a'..'z')} end context 'with a-z' do let(:value) { 'a-z' } it { is_expected.to eq('a'..'z')} end context 'with A..Z' do let(:value) { 'A..Z' } it { is_expected.to eq('A'..'Z')} end end # coerce
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tty-0.1.0 | spec/tty/coercer/range/coerce_spec.rb |