Sha256: 91eea747834c80ca51a25545b8d9e4b80504a503bc924a9ac44e712fc71da079

Contents?: true

Size: 594 Bytes

Versions: 13

Compression:

Stored size: 594 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'test_helper'

class PolymorphicAssociationTest < ActiveSupport::TestCase
  def setup
    @user = User.create :name => 'csdn', :email => 'test@csdn.com'
  end

  def test_should_get_cache_when_use_polymorphic_association
    image = @user.images.create

    @user.write_second_level_cache
    assert_no_queries do
      assert_equal @user, image.imagable
    end
  end

  def test_should_write_polymorphic_association_cache
    image = @user.images.create
    assert_nil User.read_second_level_cache(@user.id)
    assert_equal @user, image.imagable
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
second_level_cache-2.1.16 test/polymorphic_association_test.rb
second_level_cache-2.1.15 test/polymorphic_association_test.rb
second_level_cache-2.1.14 test/polymorphic_association_test.rb
second_level_cache-2.1.13 test/polymorphic_association_test.rb
second_level_cache-2.1.10 test/polymorphic_association_test.rb
second_level_cache-2.1.9 test/polymorphic_association_test.rb
second_level_cache-2.1.8 test/polymorphic_association_test.rb
second_level_cache-2.1.7 test/polymorphic_association_test.rb
second_level_cache-2.1.6 test/polymorphic_association_test.rb
second_level_cache-2.1.5 test/polymorphic_association_test.rb
second_level_cache-2.1.2 test/polymorphic_association_test.rb
second_level_cache-2.1.1 test/polymorphic_association_test.rb
second_level_cache-2.1.0 test/polymorphic_association_test.rb