Sha256: 737abc939eafef54ece589544b79d87a583c65f0f05b999126cd01f004c51af7

Contents?: true

Size: 509 Bytes

Versions: 2

Compression:

Stored size: 509 Bytes

Contents

require 'test_helper'

class RecordTest < ActiveSupport::TestCase

  test 'callbacks' do
    user = User.create(name: 'mike')
    user.cache
    key = "users/#{user.name}"
    assert_equal user.id, client.get(key).to_i

    user.update name: 'john'
    old_key = key
    key = "users/#{user.name}"
    user.recache
    assert_nil client.get(old_key)
    assert_equal user.id, client.get(key).to_i

    user.destroy
    user.uncache
    assert_nil client.get(old_key)
    assert_nil client.get(key)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cachers-4.1.0.1 test/record_test.rb
cachers-4.1.0.0 test/record_test.rb