Sha256: abdccf99258bb99f0447be5c5515d7958be52cf80d6cf71bbdbd4c9c705e1bf8
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe TTY::Conversion::FloatConverter, '#convert' do let(:object) { described_class.new } let(:strict) { true } subject(:converter) { object.convert(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.1 | spec/tty/conversion/converter/float/convert_spec.rb |