Sha256: 3af560ca7db8f1980fc69901a90ead22699eb067b278139e5572e08b9e1880d8

Contents?: true

Size: 509 Bytes

Versions: 1

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, $redis.get(key).to_i

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

    user.destroy
    user.uncache
    assert_nil $redis.get(old_key)
    assert_nil $redis.get(key)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cachers-4.0.0.0 test/record_test.rb