aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-06-23 16:52:39 +0200
committerJosé Valim <jose.valim@gmail.com>2009-06-23 16:52:39 +0200
commit0744900861892be85b4a110612a8e92aed94d858 (patch)
treee879b3cd4d0839baaa0fb50f0927c6671b75ca11 /activesupport/test/caching_test.rb
parent6dd196914c293fbc1a331e4a0bc1c06a26dded43 (diff)
parent80f1f863cd0f9cba89079511282de5710a2e1832 (diff)
downloadrails-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.rb16
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