diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-23 16:52:39 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-23 16:52:39 +0200 |
commit | 0744900861892be85b4a110612a8e92aed94d858 (patch) | |
tree | e879b3cd4d0839baaa0fb50f0927c6671b75ca11 /activesupport/test/caching_test.rb | |
parent | 6dd196914c293fbc1a331e4a0bc1c06a26dded43 (diff) | |
parent | 80f1f863cd0f9cba89079511282de5710a2e1832 (diff) | |
download | rails-0744900861892be85b4a110612a8e92aed94d858.tar.gz rails-0744900861892be85b4a110612a8e92aed94d858.tar.bz2 rails-0744900861892be85b4a110612a8e92aed94d858.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r-- | activesupport/test/caching_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 51d04d9388..c2a03818e1 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -146,6 +146,22 @@ class FileStoreTest < ActiveSupport::TestCase end include CacheStoreBehavior + + def test_expires_in + time = Time.local(2008, 4, 24) + Time.stubs(:now).returns(time) + File.stubs(:mtime).returns(time) + + @cache.write('foo', 'bar') + cache_read = lambda { @cache.read('foo', :expires_in => 1.minute) } + assert_equal 'bar', cache_read.call + + Time.stubs(:now).returns(time + 30.seconds) + assert_equal 'bar', cache_read.call + + Time.stubs(:now).returns(time + 2.minutes) + assert_nil cache_read.call + end end class MemoryStoreTest < ActiveSupport::TestCase |