Sha256: b04ab185a321e1f35eaa48451f365b1c7d09ffa541bcd1b6dc23c5b7f3498268

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

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

class TestTmpCache < MiniTest::Unit::TestCase

  def setup
    TmpCache.set('name', 'shokai', 2)
  end

  def teardown
    TmpCache.reset
  end

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

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

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

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

  def test_values
    assert TmpCache.values == ['shokai']
  end

  def test_gc
    TmpCache.set('mail', 'hashimoto@shokai.org')
    sleep 3
    assert TmpCache.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.rb