Sha256: bb200b99a8c9fa19f8f207793a794ba3931e04c297ccb82c5cb5fcb413c51516

Contents?: true

Size: 671 Bytes

Versions: 8

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Mongoid::Extensions::Set do

  describe "#demongoize" do

    it "returns the set if Array" do
      expect(Set.demongoize([ "test" ])).to eq(Set.new([ "test" ]))
    end
  end

  describe ".mongoize" do

    it "returns an array" do
      expect(Set.mongoize([ "test" ])).to eq([ "test" ])
    end

    it "returns an array even if the value is a set" do
      expect(Set.mongoize(Set.new([ "test" ]))).to eq([ "test" ])
    end
  end

  describe "#mongoize" do

    let(:set) do
      Set.new([ "test" ])
    end

    it "returns an array" do
      expect(set.mongoize).to eq([ "test" ])
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mongoid-7.5.4 spec/mongoid/extensions/set_spec.rb
mongoid-7.5.3 spec/mongoid/extensions/set_spec.rb
mongoid-7.5.2 spec/mongoid/extensions/set_spec.rb
mongoid-7.5.1 spec/mongoid/extensions/set_spec.rb
mongoid-7.4.3 spec/mongoid/extensions/set_spec.rb
mongoid-7.5.0 spec/mongoid/extensions/set_spec.rb
mongoid-7.4.1 spec/mongoid/extensions/set_spec.rb
mongoid-7.4.0 spec/mongoid/extensions/set_spec.rb