Sha256: 8a445ea4e4b3e37b2ddefb71a0d6fc903a80209c0906b990d9543ecb646db12c

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require "spec_helper"

describe Mongoid::Caching do

  before do
    @klass = Class.new do
      include Mongoid::Caching
    end
  end

  describe ".cache" do

    before do
      @klass.cache
    end

    it "sets the cached boolean on the class" do
      @klass.cached.should be_true
    end

  end

  describe ".cached" do

    it "defaults to false" do
      @klass.cached.should be_false
    end
  end

  describe ".cached?" do

    context "when the class is cached" do

      before do
        @klass.cache
      end

      it "returns true" do
        @klass.should be_cached
      end
    end

    context "when the class is not cached" do

      it "returns false" do
        @klass.should_not be_cached
      end
    end

  end

  describe "#cached?" do

    before do
      @klass.cache
      @doc = @klass.new
    end

    it "returns the class cached? value" do
      @doc.should be_cached
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-1.2.8 spec/unit/mongoid/caching_spec.rb