Sha256: ef110496c9a1d9bf4d6ba5fa4d78091e3c4385f80aa3157a2c6d114d04e7666e
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 Bytes
Contents
require "#{File.dirname(__FILE__)}/../test_helper" class MemcachedTest < Test::Unit::TestCase KEY = "memcached_test" LOCK = "lock:#{KEY}" def setup CACHE.delete KEY CACHE.delete LOCK end def test_unlocked assert_nil CACHE.get(KEY) assert_nil CACHE.get(LOCK) assert_nothing_raised do CACHE.lock(KEY) { "A" } end assert_nil CACHE.get(LOCK) assert_equal("A", CACHE.get(KEY)) end def test_locked CACHE.set LOCK, "Bogus" assert_raises MemCache::MemCacheError do CACHE.lock(KEY, 30, 2) { "A" } end assert_equal("Bogus", CACHE.get(LOCK)) assert_nil CACHE.get(KEY) end def test_ensure_lock_release assert_raises RuntimeError do CACHE.lock(KEY) { raise } end assert_nil CACHE.get(LOCK) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
interlock-1.0 | test/unit/memcached_test.rb |
interlock-1.1 | test/unit/memcached_test.rb |