Sha256: f22ddaf2275614b4f95bc8ef3423565d27879dc28a56718c6b2c04132cafa3d0

Contents?: true

Size: 1008 Bytes

Versions: 69

Compression:

Stored size: 1008 Bytes

Contents

require "spec_helper"

describe Mongoid::Config::Options do

  let(:config) do
    Mongoid::Config
  end

  describe "#defaults" do

    it "returns the default options" do
      expect(config.defaults).to_not be_empty
    end
  end

  describe "#option" do

    context "when a default is provided" do

      after do
        config.preload_models = false
      end

      it "defines a getter" do
        expect(config.preload_models).to be false
      end

      it "defines a setter" do
        (config.preload_models = expect(true)).to be true
      end

      it "defines a presence check" do
        expect(config).to_not be_preload_models
      end
    end
  end

  describe "#reset" do

    before do
      config.preload_models = true
      config.reset
    end

    it "resets the settings to the defaults" do
      expect(config.preload_models).to be false
    end
  end

  describe "#settings" do

    it "returns the settings" do
      expect(config.settings).to_not be_empty
    end
  end
end

Version data entries

69 entries across 64 versions & 3 rubygems

Version Path
mongoid-7.0.13 spec/mongoid/config/options_spec.rb
mongoid-7.0.12 spec/mongoid/config/options_spec.rb
mongoid-6.4.8 spec/mongoid/config/options_spec.rb
mongoid-7.0.11 spec/mongoid/config/options_spec.rb
mongoid-7.0.10 spec/mongoid/config/options_spec.rb
mongoid-6.4.7 spec/mongoid/config/options_spec.rb
mongoid-6.4.5 spec/mongoid/config/options_spec.rb
mongoid-7.0.8 spec/mongoid/config/options_spec.rb
mongoid-7.0.7 spec/mongoid/config/options_spec.rb
mongoid-7.0.6 spec/mongoid/config/options_spec.rb
mongoid-5.4.1 spec/mongoid/config/options_spec.rb
mongoid-7.0.5 spec/mongoid/config/options_spec.rb
mongoid-7.0.4 spec/mongoid/config/options_spec.rb
mongoid-6.4.4 spec/mongoid/config/options_spec.rb
mongoid-7.0.3 spec/mongoid/config/options_spec.rb
mongoid-6.4.2 spec/mongoid/config/options_spec.rb
mongoid-7.0.2 spec/mongoid/config/options_spec.rb
mongoid-7.0.1 spec/mongoid/config/options_spec.rb
mongoid-6.4.1 spec/mongoid/config/options_spec.rb
mongoid-5.4.0 spec/mongoid/config/options_spec.rb