aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/file_update_checker_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/file_update_checker_test.rb')
-rw-r--r--activesupport/test/file_update_checker_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/file_update_checker_test.rb b/activesupport/test/file_update_checker_test.rb
index 8adff5de8d..bd1df0f858 100644
--- a/activesupport/test/file_update_checker_test.rb
+++ b/activesupport/test/file_update_checker_test.rb
@@ -48,6 +48,21 @@ class FileUpdateCheckerWithEnumerableTest < ActiveSupport::TestCase
assert_equal 1, i
end
+ def test_should_be_robust_to_handle_files_with_wrong_modified_time
+ i = 0
+ now = Time.now
+ time = Time.mktime(now.year + 1, now.month, now.day) # wrong mtime from the future
+ File.utime time, time, FILES[2]
+
+ checker = ActiveSupport::FileUpdateChecker.new(FILES){ i += 1 }
+
+ sleep(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 }