Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix failing test in file update checker

Introduced in 1abe316

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.
  • Loading branch information...
commit 33192cfa07d82e345910cdb279f15305ad463faa 1 parent a4dd871
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 activesupport/test/file_update_checker_test.rb
View
5 activesupport/test/file_update_checker_test.rb
@@ -50,12 +50,13 @@ def test_should_be_robust_enough_to_handle_deleted_files
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

2 comments on commit 33192cf

@abonec

Sorry about that it's my first pull request. But why you change sleep to 1?

@carlosantoniodasilva

No worries :). Mainly following the other test patterns using sleep, otherwise the test fails due to time comparison (it does not work with the time change in the touched files).

Please sign in to comment.
Something went wrong with that request. Please try again.