Sha256: 02577ba18183c194457d3f478c84da82eebe0faf00661bda2ee5457079805fd4
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
class Foo def bar; "bar"; end end should "return nil trying to get a value that doesn't exist" do assert_equal nil, Padrino.cache.get(@test_key) end should 'set and get an object w/marshal' do Padrino.cache.parser = :marshal Padrino.cache.set(@test_key, Foo.new) assert_equal "bar", Padrino.cache.get(@test_key).bar end should 'set and get a nil value' do Padrino.cache.set(@test_key, nil) assert_equal '', Padrino.cache.get(@test_key).to_s end should 'set and get a raw value' do Padrino.cache.set(@test_key, 'foo') assert_equal 'foo', Padrino.cache.get(@test_key) end should "set a value that expires" do Padrino.cache.set(@test_key, 'test', :expires_in => 1) # assert_equal 'test', Padrino.cache.get(@test_key) # Fails on race condition sleep 2 assert_equal nil, Padrino.cache.get(@test_key) end should 'delete a value' do Padrino.cache.set(@test_key, 'test') assert_equal 'test', Padrino.cache.get(@test_key) Padrino.cache.delete(@test_key) assert_equal nil, Padrino.cache.get(@test_key) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
padrino-cache-0.11.2 | test/shared.rb |
padrino-cache-0.11.1 | test/shared.rb |
padrino-cache-0.11.0 | test/shared.rb |