diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-04-21 10:54:54 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-04-21 10:54:54 -0600 |
commit | 1f47c4b0df01926c2237ac0777547a9d7802adbb (patch) | |
tree | d63d454357fb1e0619c30468a531cc4cec690e0f /activesupport/test | |
parent | 81f4a7dce42e4a81f02c4b2d060d92b718b03d5a (diff) | |
download | rails-1f47c4b0df01926c2237ac0777547a9d7802adbb.tar.gz rails-1f47c4b0df01926c2237ac0777547a9d7802adbb.tar.bz2 rails-1f47c4b0df01926c2237ac0777547a9d7802adbb.zip |
Make file update checker tests more resilient on Windows
Without the `wdm` gem, it appears that `listen` keeps an open handle to
each of these files, causing them not to be removed when the tempdir
tries to clean iteslf up, and then directory to fail to unlink. In
addition to fixing that particular failure, we now construct OS agnostic
paths, and capture exceptions if the directory fails to unlink so that
minitest will report it rather than crash
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/file_update_checker_shared_tests.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/activesupport/test/file_update_checker_shared_tests.rb b/activesupport/test/file_update_checker_shared_tests.rb index 12e67a1e9f..40ae0c7617 100644 --- a/activesupport/test/file_update_checker_shared_tests.rb +++ b/activesupport/test/file_update_checker_shared_tests.rb @@ -9,7 +9,7 @@ module FileUpdateCheckerSharedTests end def tmpfile(name) - "#{tmpdir}/#{name}" + File.join(tmpdir, name) end def tmpfiles @@ -17,7 +17,9 @@ module FileUpdateCheckerSharedTests end def run(*args) - Dir.mktmpdir(nil, __dir__) { |dir| @tmpdir = dir; super } + capture_exceptions do + Dir.mktmpdir(nil, __dir__) { |dir| @tmpdir = dir; super } + end end test 'should not execute the block if no paths are given' do @@ -225,7 +227,7 @@ module FileUpdateCheckerSharedTests assert !checker.execute_if_updated assert_equal 0, i - touch("#{subdir}/nested.rb") + touch(File.join(subdir, "nested.rb")) assert checker.execute_if_updated assert_equal 1, i @@ -245,12 +247,12 @@ module FileUpdateCheckerSharedTests assert_equal 0, i # subdir does not look for Ruby files, but its parent tmpdir does. - touch("#{subdir}/nested.rb") + touch(File.join(subdir, "nested.rb")) assert checker.execute_if_updated assert_equal 1, i - touch("#{subdir}/nested.txt") + touch(File.join(subdir, "nested.txt")) assert checker.execute_if_updated assert_equal 2, i |