Sha256: d42c0bcc947ed349f8ee594db6e2a9451b140aead38b7f877ccf9ddfb5be724f

Contents?: true

Size: 1.41 KB

Versions: 38

Compression:

Stored size: 1.41 KB

Contents

require "spec_helper"

describe NilClass do

  describe "#__add__" do

    it "returns the object" do
      expect(nil.__add__(1)).to eq(1)
    end
  end

  describe "#__evolve_date__" do

    it "returns nil" do
      expect(nil.__evolve_date__).to be_nil
    end
  end

  describe "#__evolve_time__" do

    it "returns nil" do
      expect(nil.__evolve_time__).to be_nil
    end
  end

  describe "#__intersect__" do

    context "when provided a non enumerable" do

      it "returns the object" do
        expect(nil.__intersect__(1)).to eq(1)
      end
    end

    context "when provided an array" do

      it "returns the array" do
        expect(nil.__intersect__([ 1, 2 ])).to eq([ 1, 2 ])
      end
    end

    context "when provided a hash" do

      it "returns the hash" do
        expect(nil.__intersect__({ "$in" => [ 1, 2 ] })).to eq(
          { "$in" => [ 1, 2 ] }
        )
      end
    end
  end

  describe "#__union__" do

    context "when provided a non enumerable" do

      it "returns the object" do
        expect(nil.__union__(1)).to eq(1)
      end
    end

    context "when provided an array" do

      it "returns the array" do
        expect(nil.__union__([ 1, 2 ])).to eq([ 1, 2 ])
      end
    end

    context "when provided a hash" do

      it "returns the hash" do
        expect(nil.__union__({ "$in" => [ 1, 2 ] })).to eq(
          { "$in" => [ 1, 2 ] }
        )
      end
    end
  end
end

Version data entries

38 entries across 36 versions & 2 rubygems

Version Path
mongoid-7.0.13 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.12 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.8 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.11 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.10 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.7 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.5 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.8 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.7 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.6 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.5 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.4 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.4 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.3 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.2 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.2 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.1 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-6.4.1 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
mongoid-7.0.0 spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb