Sha256: 51138f57bb5f0bccc2c84cab0bf536051954a2d260013531940507bfb0b732bc

Contents?: true

Size: 833 Bytes

Versions: 6

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require "spec_helper"

describe Mongoid::Extensions::FalseClass do

  describe "#__sortable__" do

    it "returns 0" do
      expect(false.__sortable__).to eq(0)
    end
  end

  describe "#is_a?" do

    context "when provided a Boolean" do

      it "returns true" do
        expect(false.is_a?(Mongoid::Boolean)).to be true
      end
    end

    context "when provided a FalseClass" do

      it "returns true" do
        expect(false.is_a?(FalseClass)).to be true
      end
    end

    context "when provided a TrueClass" do

      it "returns false" do
        expect(false.is_a?(TrueClass)).to be false
      end
    end

    context "when provided an invalid class" do

      it "returns false" do
        expect(false.is_a?(String)).to be false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-7.3.5 spec/mongoid/extensions/false_class_spec.rb
mongoid-7.3.4 spec/mongoid/extensions/false_class_spec.rb
mongoid-7.3.3 spec/mongoid/extensions/false_class_spec.rb
mongoid-7.3.2 spec/mongoid/extensions/false_class_spec.rb
mongoid-7.3.1 spec/mongoid/extensions/false_class_spec.rb
mongoid-7.3.0 spec/mongoid/extensions/false_class_spec.rb