Fix failing test in file update checker

Introduced in 1abe31670f

The test was failing when running on isolation, because the extensions were
not being loaded, thus 1.year.from_now was failing. Just use mktime
instead, adding 1 year to Time.now.
This commit is contained in:
Carlos Antonio da Silva 2012-06-29 15:08:08 -03:00
parent a4dd8719e5
commit 33192cfa07
1 changed files with 3 additions and 2 deletions

View File

@ -50,12 +50,13 @@ class FileUpdateCheckerWithEnumerableTest < ActiveSupport::TestCase
def test_should_be_robust_to_handle_files_with_wrong_modified_time
i = 0
time = 1.year.from_now # wrong mtime from the future
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(0.1)
sleep(1)
FileUtils.touch(FILES[0..1])
assert checker.execute_if_updated