Sha256: 2e328376d4d74de221af1df10cd8f46e7639298d8f3b7bd52e1888b0b4de8ac7

Contents?: true

Size: 1.74 KB

Versions: 4

Compression:

Stored size: 1.74 KB

Contents

require "spec_helper"

describe Mongoid::Config do

  after :all do
    config.raise_not_found_error = true
  end

  let(:config) { Mongoid::Config.instance }

  describe ".database=" do

    context "when object provided is not a Mongo::DB" do

      it "raises an error" do
        lambda { config.database = "Test" }.should raise_error
      end

    end

  end

  describe "#persist_in_safe_mode=" do

    context "when setting to true" do

      before do
        config.persist_in_safe_mode = true
      end

      it "sets the value" do
        config.persist_in_safe_mode.should == true
      end

    end

    context "when setting to false" do

      before do
        config.persist_in_safe_mode = false
      end

      it "sets the value" do
        config.persist_in_safe_mode.should == false
      end

    end

  end

  describe "#raise_not_found_error=" do

    context "when setting to true" do

      before do
        config.raise_not_found_error = true
      end

      it "sets the value" do
        config.raise_not_found_error.should == true
      end

    end

    context "when setting to false" do

      before do
        config.raise_not_found_error = false
      end

      it "sets the value" do
        config.raise_not_found_error.should == false
      end

    end

  end

  describe "#allow_dynamic_fields=" do

    context "when setting to true" do

      before do
        config.allow_dynamic_fields = true
      end

      it "sets the value" do
        config.allow_dynamic_fields.should == true
      end

    end

    context "when setting to false" do

      before do
        config.allow_dynamic_fields = false
      end

      it "sets the value" do
        config.allow_dynamic_fields.should == false
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-1.1.4 spec/unit/mongoid/config_spec.rb
mongoid-1.1.3 spec/unit/mongoid/config_spec.rb
mongoid-1.1.2 spec/unit/mongoid/config_spec.rb
mongoid-1.1.1 spec/unit/mongoid/config_spec.rb