Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (35 sloc) 0.894 kb
require 'test_helper'
class DiskCacheTest < MiniTest::Unit::TestCase
DIR = "/tmp/geminabox-disk-cache-test"
def setup
FileUtils.rm_rf(DIR)
end
def subject
@subject ||= Geminabox::DiskCache.new(DIR)
end
def test_cache_some_stuff
called = 0
callable = lambda{
subject.cache("foo") do
called += 1
"HELLO"
end
}
assert_equal "HELLO", callable.call
assert_equal "HELLO", callable.call
assert_equal 1, called
end
def test_flushing_the_cache
assert_equal "foo", subject.cache("foo"){ "foo" }
assert_equal "foo", subject.cache("foo"){ "bar" }
subject.flush
assert_equal "bar", subject.cache("foo"){ "bar" }
end
def test_multiple_keys
assert_equal "foo", subject.cache("foo"){ "foo" }
assert_equal "bar", subject.cache("bar"){ "bar" }
end
def teardown
FileUtils.rm_rf(DIR)
end
end
Jump to Line
Something went wrong with that request. Please try again.