Sha256: e6edfbc381ca49a478b1b6e2ea7c49ec807f339ed76317a98a0884030ca5104c
Contents?: true
Size: 767 Bytes
Versions: 5
Compression:
Stored size: 767 Bytes
Contents
require 'spec_helper' describe TTY::Coercer::Integer, '#coerce' do let(:strict) { true } subject { described_class.coerce(value, strict) } context 'with empty' do let(:value) { '' } it { expect { subject }.to raise_error(TTY::InvalidArgument) } end context 'with 1 as string' do let(:value) { '1' } it { expect(subject).to eql 1 } end context 'with float' do let(:value) { 1.2 } it { expect { subject }.to raise_error(TTY::InvalidArgument) } end context 'with float not strict' do let(:value) { 1.2 } let(:strict) { false } it { expect(subject).to eql 1 } end context 'with letters not strict' do let(:value) { '1abc' } let(:strict) { false } it { expect(subject).to eql 1 } end end
Version data entries
5 entries across 5 versions & 1 rubygems