Sha256: d0cb0e6626c74dc061198bd4b19bc7b8ffd99ea7fccb474f3978aaf507d0cae2
Contents?: true
Size: 554 Bytes
Versions: 5
Compression:
Stored size: 554 Bytes
Contents
require 'spec_helper' describe Virtus::Coercion::String, '.to_decimal' do subject { object.to_decimal(string) } let(:object) { described_class } { '1' => BigDecimal('1.0'), '1.0' => BigDecimal('1.0'), '.1' => BigDecimal('0.1') }.each do |value, expected| context "with #{value.inspect}" do let(:string) { value } it { should be_instance_of(BigDecimal) } it { should eql(expected) } end end context 'with an invalid decimal string' do let(:string) { 'non-decimal' } it { should equal(string) } end end
Version data entries
5 entries across 5 versions & 1 rubygems