Sha256: e537ead0c088b59bdaf246db3aa59f64a9168bead21a9de6382715e6f936f30b

Contents?: true

Size: 726 Bytes

Versions: 8

Compression:

Stored size: 726 Bytes

Contents

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

class ActiveRecord::BelongsToAssociationTest < Test::Unit::TestCase
  def setup
    @user = User.create :name => 'csdn', :email => 'test@csdn.com'
  end

  def test_should_get_cache_when_use_belongs_to_association
    book = @user.books.create

    @user.write_second_level_cache
    book.clear_association_cache
    no_connection do
      assert_equal @user, book.user
    end
  end

  def test_should_write_belongs_to_association_cache
    book = @user.books.create
    @user.expire_second_level_cache
    assert_nil User.read_second_level_cache(@user.id)
    assert_equal @user, book.user
    # assert_not_nil User.read_second_level_cache(@user.id)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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