Sha256: b6136502e53a0a4c36f221c9d3f1b3de18ebdd6d04e8437df2fe2a3ab2393855

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

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

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

  def test_should_find_without_cache
    SecondLevelCache.cache_store.clear
    assert_equal @user, User.find(@user.id)
  end

  def test_should_find_with_cache
    @user.write_second_level_cache
    no_connection do
      assert_equal @user, User.find(@user.id)
    end
  end

  def test_should_find_with_condition
    @user.write_second_level_cache
    no_connection do
      assert_equal @user, User.where(:name => @user.name).find(@user.id)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
second_level_cache-1.5.1 test/active_record/finder_methods_test.rb
second_level_cache-1.5.0 test/active_record/finder_methods_test.rb