Sha256: 19766fae9d3a5ab72cf25a4d3a67c9101914fd4fdf1178d9cbc7d37762c6223c

Contents?: true

Size: 646 Bytes

Versions: 3

Compression:

Stored size: 646 Bytes

Contents

require "test_helper"

class IdentityCacheTest < IdentityCache::TestCase

  class BadModelBase < ActiveRecord::Base
    include IdentityCache
  end

  class BadModel < BadModelBase
  end

  def test_identity_cache_raises_if_loaded_twice
    assert_raises(IdentityCache::AlreadyIncludedError) do
      BadModel.class_eval do
        include IdentityCache
      end
    end
  end

  def test_should_use_cache_outside_transaction
    assert_equal true, IdentityCache.should_use_cache?
  end

  def test_should_use_cache_in_transaction
    ActiveRecord::Base.transaction do
      assert_equal false, IdentityCache.should_use_cache?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
identity_cache-0.5.1 test/identity_cache_test.rb
identity_cache-0.5.0 test/identity_cache_test.rb
identity_cache-0.4.1 test/identity_cache_test.rb