Sha256: 36ad274d9b8e8049914a7d411e68ee14ccd0f88c6b39c343ad16f5ea5c939c01

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

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

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

  def test_should_reload_object
    User.increment_counter :books_count, @user.id
    assert_equal 0, @user.books_count
    assert_equal 1, @user.reload.books_count
  end

  def test_should_clean_cache_after_touch
    post = @topic.posts.create
    post.body = "body"
    post.save
    new_topic = Topic.find @topic.id
    assert !(new_topic.updated_at == @topic.updated_at)
  end

  def test_should_return_true_if_touch_ok
    assert @topic.touch == true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
second_level_cache-1.5.1 test/active_record/persistence_test.rb
second_level_cache-1.5.0 test/active_record/persistence_test.rb
second_level_cache-1.3.2 test/active_record/persistence_test.rb