aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorBlake Mesdag <blakemesdag@gmail.com>2016-04-12 12:07:56 -0400
committerBlake Mesdag <blakemesdag@gmail.com>2016-04-12 12:07:56 -0400
commitb0bce0b8ce807e4d92a8a01fa0235727d709c21d (patch)
tree7fa833470131abb591e950f72f8e6ee8582583af /activesupport/test
parentd6769f4d106ee6f9a3bbad925098260bdac5f799 (diff)
downloadrails-b0bce0b8ce807e4d92a8a01fa0235727d709c21d.tar.gz
rails-b0bce0b8ce807e4d92a8a01fa0235727d709c21d.tar.bz2
rails-b0bce0b8ce807e4d92a8a01fa0235727d709c21d.zip
Handle max_time edge cases for epoch times and add test
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/file_update_checker_shared_tests.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/file_update_checker_shared_tests.rb b/activesupport/test/file_update_checker_shared_tests.rb
index 5207860a0e..a78c3a67b6 100644
--- a/activesupport/test/file_update_checker_shared_tests.rb
+++ b/activesupport/test/file_update_checker_shared_tests.rb
@@ -134,6 +134,23 @@ module FileUpdateCheckerSharedTests
assert_equal 1, i
end
+ test 'should return max_time for files with mtime = Time.at(0)' do
+ i = 0
+
+ FileUtils.touch(tmpfiles)
+
+ now = Time.now
+ time = Time.at(0) # wrong mtime from the future
+ File.utime(time, time, tmpfiles[0])
+
+ checker = new_checker(tmpfiles) { i += 1 }
+
+ touch(tmpfiles[1..-1])
+
+ assert checker.execute_if_updated
+ assert_equal 1, i
+ end
+
test 'should cache updated result until execute' do
i = 0