Sha256: fb8bd1ce72e16f1e507d45b78e42f67bd9263c4223ffb0b6f9edfc0756f79ee7
Contents?: true
Size: 761 Bytes
Versions: 12
Compression:
Stored size: 761 Bytes
Contents
# encoding: utf-8 require 'bigdecimal' require_relative "../spec_helper" require 'stringio' describe ::BigDecimal do let(:a_number) { "4321.1234" } let(:bson_number) { 4321.1234.to_bson } subject { described_class.new(a_number) } it "responds to to_bson" do expect(subject).to respond_to(:to_bson) end it "to_bson returns a binary encoded number" do expect(subject.to_bson).to eq(4321.1234.to_bson) end it "bson_type returns a binary encoded 1" do expect(subject.bson_type).to eq(12.34.bson_type) end describe "class methods" do it "builds a new BigDecimal from BSON" do decoded = described_class.from_bson(StringIO.new(4321.1234.to_bson)) expect(decoded).to eql(BigDecimal.new(a_number)) end end end
Version data entries
12 entries across 12 versions & 3 rubygems