Sha256: 0a5e99682eae295e13c145390491f9c6bb3d95e1e1c5a510eac756325c22e639

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'spec_helper'

describe OData4::Properties::Decimal do
  let(:subject) { OData4::Properties::Decimal.new('Decimal', '678.90325') }

  it { expect(subject.type).to eq('Edm.Decimal') }
  it { expect(subject.value).to eq(BigDecimal('678.90325')) }

  it { expect(subject.url_value).to eq('678.90325M') }

  it { expect { subject.value = BigDecimal((7.9 * (10**28)), 2) + 1 }.to raise_error(ArgumentError) }
  it { expect { subject.value = BigDecimal((-7.9 * (10**28)), 2) - 1 }.to raise_error(ArgumentError) }
  it { expect { subject.value = BigDecimal((3.4 * (10**-28)), 2) * 3.14151 + 5 }.to raise_error(ArgumentError) }

  it { expect(lambda {
    subject.value = '19.89043256'
    subject.value
  }.call).to eq(BigDecimal('19.89043256')) }

  it { expect(lambda {
    subject.value = BigDecimal('19.89043256')
    subject.value
  }.call).to eq(BigDecimal('19.89043256')) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
odata4-0.7.0 spec/odata4/properties/decimal_spec.rb