Sha256: cbb4952d29c220fb327946e250e9605e0186d61f61131c13b086502102936cca

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestTmpCacheInstance < MiniTest::Unit::TestCase

  def setup
    @tmp_cache = TmpCache::Cache.new
    @tmp_cache.set('name', 'shokai', 2)
  end

  def test_get
    assert @tmp_cache.get('name') == 'shokai'
  end

  def test_expire
    sleep 3
    assert @tmp_cache.get('name') == nil
  end

  def test_reset
    @tmp_cache.reset
    assert @tmp_cache.get('name') == nil
  end

  def test_keys
    @tmp_cache.set('mail', 'hashimoto@shokai.org')
    assert @tmp_cache.keys.sort == ['name', 'mail'].sort
  end

  def test_values
    assert @tmp_cache.values == ['shokai']
  end

  def test_gc
    @tmp_cache.set('mail', 'hashimoto@shokai.org')
    sleep 3
    assert @tmp_cache.keys == ['mail']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tmp_cache-0.1.1 test/test_tmp_cache_instance.rb