Sha256: 07eed28a45a0fdfa902ad23dad787d604cc931a1834dcfec230a347d2c294420

Contents?: true

Size: 616 Bytes

Versions: 7

Compression:

Stored size: 616 Bytes

Contents

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

class ActiveRecord::PolymorphicAssociationTest < Test::Unit::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
    no_connection 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

7 entries across 7 versions & 1 rubygems

Version Path
second_level_cache-2.0.0 test/active_record/polymorphic_association_test.rb
second_level_cache-2.0.0.rc1 test/active_record/polymorphic_association_test.rb
second_level_cache-2.0.0.beta test/active_record/polymorphic_association_test.rb
second_level_cache-1.6.2 test/active_record/polymorphic_association_test.rb
second_level_cache-1.6.1 test/active_record/polymorphic_association_test.rb
second_level_cache-1.6.0 test/active_record/polymorphic_association_test.rb
second_level_cache-1.5.1 test/active_record/polymorphic_association_test.rb