aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/file_update_checker_shared_tests.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-04-12 10:56:42 -0700
committerXavier Noria <fxn@hashref.com>2016-04-12 10:56:42 -0700
commitb271eda7031aa5cdd2fd4db2ae5fdbee5efd5cb6 (patch)
tree0e7a7cbddad1954f72fa83febcd0ae411f705417 /activesupport/test/file_update_checker_shared_tests.rb
parent714ab8cb5976587470c8487720094c1efb2ba9a2 (diff)
parentf05704fc1aec5f859c78a75d26dc694c51a729af (diff)
downloadrails-b271eda7031aa5cdd2fd4db2ae5fdbee5efd5cb6.tar.gz
rails-b271eda7031aa5cdd2fd4db2ae5fdbee5efd5cb6.tar.bz2
rails-b271eda7031aa5cdd2fd4db2ae5fdbee5efd5cb6.zip
Merge pull request #24523 from BlakeMesdag/as-max_time-fix-edges
Handle max_time edge cases for epoch times and add test
Diffstat (limited to 'activesupport/test/file_update_checker_shared_tests.rb')
-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