Sha256: 59f59d9256c240fd3eb5a9620346255562facbc5d7b56654feb418ea4d20a8c1
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe TTY::Coercer::Float, '#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 { is_expected.to eql 1.0 } end context 'with float' do let(:value) { '1.2a' } it { expect { subject }.to raise_error(TTY::InvalidArgument) } end context 'with float not strict' do let(:value) { '1.2abc'} let(:strict) { false } it { is_expected.to eql 1.2 } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tty-0.1.0 | spec/tty/coercer/float/coerce_spec.rb |