Sha256: a1485c5d63e9d542120a5bcdd32163f6216252590b6b9d480324e99bcee7b03f

Contents?: true

Size: 956 Bytes

Versions: 7

Compression:

Stored size: 956 Bytes

Contents

require "spec_helper"

describe Mongoid do

  describe ".configure" do

    context "when no block supplied" do

      it "returns the config singleton" do
        Mongoid.configure.should == Mongoid::Config.instance
      end
    end

    context "when a block is supplied" do

      before do
        Mongoid.configure do |config|
          config.allow_dynamic_fields = false
        end
      end

      after do
        Mongoid.configure do |config|
          config.allow_dynamic_fields = true
        end
      end

      it "sets the values on the config instance" do
        Mongoid.allow_dynamic_fields.should be_false
      end
    end
  end

  describe ".deprecate" do

    before do
      @deprecation = mock
      Mongoid::Deprecation.expects(:instance).returns(@deprecation)
    end

    it "calls alert on the deprecation singleton" do
      @deprecation.expects(:alert).with("testing")
      Mongoid.deprecate("testing")
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 spec/unit/mongoid_spec.rb
mongoid-2.0.0.alpha spec/unit/mongoid_spec.rb
mongoid-1.2.14 spec/unit/mongoid_spec.rb
mongoid-1.2.13 spec/unit/mongoid_spec.rb
mongoid-1.2.12 spec/unit/mongoid_spec.rb
mongoid-1.2.11 spec/unit/mongoid_spec.rb
mongoid-1.2.10 spec/unit/mongoid_spec.rb