Sha256: 2a8818788e3224e3beb214382670b39494cf82ed9193e3951f899536a4ef0923
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') describe Attributor::BigDecimal do subject(:type) { Attributor::BigDecimal } it 'it is not Dumpable' do expect(type.new.is_a?(Attributor::Dumpable)).not_to be(true) end context '.native_type' do its(:native_type) { should be(::BigDecimal) } end context '.example' do its(:example) { should be_a(::BigDecimal) } end context '.load' do let(:value) { nil } it 'returns nil for nil' do expect(type.load(nil)).to be(nil) end context 'for incoming Float values' do it 'returns the incoming value' do [0.0, -1.0, 1.0, 1e-10, 0.25135].each do |value| expect(type.load(value)).to eq(value) end end end context 'for incoming Integer values' do it 'should equal the incoming value' do [0, -1, 1].each do |value| expect(type.load(value)).to eq(value) end end end context 'for incoming String values' do it 'should equal the value' do expect(type.load('0')).to eq(0) expect(type.load('100')).to eq(100) expect(type.load('0.1')).to eq(0.1) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems