Sha256: a66bfcd40a757448aa0751adb8c42e955aefe394e8da014edc96e328103aad5a

Contents?: true

Size: 961 Bytes

Versions: 27

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require "spec_helper"

describe Mongoid::Extensions::Decimal128 do

  let(:decimal128) do
    BSON::Decimal128.new("0.0005")
  end

  describe "#__evolve_decimal128__" do

    it "returns the same instance" do
      expect(decimal128.__evolve_decimal128__).to be(decimal128)
    end
  end

  describe ".evolve" do

    context "when provided a single decimal128" do

      let(:evolved) do
        BSON::Decimal128.evolve(decimal128)
      end

      it "returns the decimal128" do
        expect(evolved).to be(decimal128)
      end
    end

    context "when provided an array of decimal128s" do

      let(:other_decimal128) do
        BSON::Decimal128.new("3.14")
      end

      let(:evolved) do
        BSON::ObjectId.evolve([decimal128, other_decimal128])
      end

      it "returns the array of decimal128s" do
        expect(evolved).to eq([decimal128, other_decimal128])
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongoid-7.3.5 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.3.4 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.11 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.6 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.3.3 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.3.2 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.5 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.10 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.9 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.4 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.3.1 spec/mongoid/extensions/decimal128_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.3.0 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.3 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.8 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.2 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.1 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.7 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.2.0 spec/mongoid/extensions/decimal128_spec.rb
mongoid-7.1.6 spec/mongoid/extensions/decimal128_spec.rb