Sha256: 29a5ced398f92a3f66deb2326a9363a9caafc01d7ebef5d7d855a40b86cd43ab

Contents?: true

Size: 984 Bytes

Versions: 3

Compression:

Stored size: 984 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
      config.defaults.should_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
        config.preload_models.should be_false
      end

      it "defines a setter" do
        (config.preload_models = true).should be_true
      end

      it "defines a presence check" do
        config.should_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
      config.preload_models.should be_false
    end
  end

  describe "#settings" do

    it "returns the settings" do
      config.settings.should_not be_empty
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-3.1.7 spec/mongoid/config/options_spec.rb
mongoid-3.1.6 spec/mongoid/config/options_spec.rb
mongoid-3.1.5 spec/mongoid/config/options_spec.rb