Sha256: 36bdcc5818130a2fb134fc2c04073df62e3c8ba4547a7ab4fd3d72f27e46d90f

Contents?: true

Size: 592 Bytes

Versions: 15

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

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

15 entries across 15 versions & 1 rubygems

Version Path
second_level_cache-2.7.1 test/polymorphic_association_test.rb
second_level_cache-2.7.0 test/polymorphic_association_test.rb
second_level_cache-2.6.4 test/polymorphic_association_test.rb
second_level_cache-2.6.3 test/polymorphic_association_test.rb
second_level_cache-2.6.2 test/polymorphic_association_test.rb
second_level_cache-2.6.1 test/polymorphic_association_test.rb
second_level_cache-2.6.0 test/polymorphic_association_test.rb
second_level_cache-2.5.3 test/polymorphic_association_test.rb
second_level_cache-2.5.2 test/polymorphic_association_test.rb
second_level_cache-2.5.0 test/polymorphic_association_test.rb
second_level_cache-2.4.4 test/polymorphic_association_test.rb
second_level_cache-2.4.3 test/polymorphic_association_test.rb
second_level_cache-2.4.2 test/polymorphic_association_test.rb
second_level_cache-2.4.1 test/polymorphic_association_test.rb
second_level_cache-2.4.0 test/polymorphic_association_test.rb