aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-06-23 18:13:46 -0300
committerEmilio Tagua <miloops@gmail.com>2009-06-23 18:13:46 -0300
commitb9088dce07f8525cdb84a1312a77b81db79067d6 (patch)
tree72ace069842b074981ba814ef1c335271176ce27 /activesupport/test/caching_test.rb
parent4864f92ee34e840307d968fa8b04972b6d786fe8 (diff)
parent4417a19b035d73eb46a5e06e296a4b1c8091bef1 (diff)
downloadrails-b9088dce07f8525cdb84a1312a77b81db79067d6.tar.gz
rails-b9088dce07f8525cdb84a1312a77b81db79067d6.tar.bz2
rails-b9088dce07f8525cdb84a1312a77b81db79067d6.zip
Merge commit 'rails/master'
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