diff options
author | abonec <abonec@gmail.com> | 2012-06-29 19:43:33 +0400 |
---|---|---|
committer | abonec <abonec@gmail.com> | 2012-06-29 19:43:33 +0400 |
commit | 20519efa6ede07b7a7f43ccd69d39b84c39f8195 (patch) | |
tree | 6f60b70e9d1682f54d78744cae444b4a62629139 /activesupport/test | |
parent | 0470ddcf0301e537d5151d62177eadba5eae182d (diff) | |
download | rails-20519efa6ede07b7a7f43ccd69d39b84c39f8195.tar.gz rails-20519efa6ede07b7a7f43ccd69d39b84c39f8195.tar.bz2 rails-20519efa6ede07b7a7f43ccd69d39b84c39f8195.zip |
fix FileUpdateChecker when file has wrong mtime (from future)
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/file_update_checker_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/file_update_checker_test.rb b/activesupport/test/file_update_checker_test.rb index 8adff5de8d..9d5417b70c 100644 --- a/activesupport/test/file_update_checker_test.rb +++ b/activesupport/test/file_update_checker_test.rb @@ -48,6 +48,20 @@ class FileUpdateCheckerWithEnumerableTest < ActiveSupport::TestCase assert_equal 1, i end + def test_should_be_robust_to_handle_files_with_wrong_modified_time + i = 0 + time = 1.year.from_now # wrong mtime from the future + File.utime time, time, FILES[2] + + checker = ActiveSupport::FileUpdateChecker.new(FILES){ i += 1 } + + sleep(0.1) + FileUtils.touch(FILES[0..1]) + + assert checker.execute_if_updated + assert_equal 1, i + end + def test_should_cache_updated_result_until_execute i = 0 checker = ActiveSupport::FileUpdateChecker.new(FILES){ i += 1 } |