Sha256: 1e318257d131be33bd6dec4a92633696fcd4a79e4d79426618a212d5139a8212
Contents?: true
Size: 969 Bytes
Versions: 10
Compression:
Stored size: 969 Bytes
Contents
require "bigdecimal" require "spec_helper" describe BaseCRM::Coercion do describe "to_decimal" do it { expect(BaseCRM::Coercion.to_decimal_value(0)).to eql(0) } it { expect(BaseCRM::Coercion.to_decimal_value("0")).to eql(0) } it { expect(BaseCRM::Coercion.to_decimal_value(nil)).to eql(0) } it { expect(BaseCRM::Coercion.to_decimal_value(1.1)).to eql(BigDecimal.new("1.1", 15)) } it { expect(BaseCRM::Coercion.to_decimal_value("1.11")).to eql(BigDecimal.new("1.11", 15)) } end describe "to_string" do it { expect(BaseCRM::Coercion.to_string(1)).to eql("1") } it { expect(BaseCRM::Coercion.to_string("1")).to eql("1") } it { expect(BaseCRM::Coercion.to_string(1.11)).to eql("1.11") } it { expect(BaseCRM::Coercion.to_string("1.11")).to eql("1.11") } it { expect(BaseCRM::Coercion.to_string(BigDecimal("1.11"))).to eql("1.11") } it { expect(BaseCRM::Coercion.to_string(BigDecimal(1.11, 15))).to eql("1.11") } end end
Version data entries
10 entries across 10 versions & 1 rubygems