aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/evented_file_update_checker_test.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-05-22 16:58:01 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-05-23 11:41:04 -0700
commitf1084f2d0eaf8405284b2da19e8ac2c2eb7063ad (patch)
treed0705d22c920156008580d44198525b24178d57a /activesupport/test/evented_file_update_checker_test.rb
parenta85c372798723b900762c27e62c35689905327aa (diff)
downloadrails-f1084f2d0eaf8405284b2da19e8ac2c2eb7063ad.tar.gz
rails-f1084f2d0eaf8405284b2da19e8ac2c2eb7063ad.tar.bz2
rails-f1084f2d0eaf8405284b2da19e8ac2c2eb7063ad.zip
Use existing tmpdir in evented_file_update_test
The common include of this test creates a tmpdir, we should use that for consistency.
Diffstat (limited to 'activesupport/test/evented_file_update_checker_test.rb')
-rw-r--r--activesupport/test/evented_file_update_checker_test.rb38
1 files changed, 18 insertions, 20 deletions
diff --git a/activesupport/test/evented_file_update_checker_test.rb b/activesupport/test/evented_file_update_checker_test.rb
index b2d5eb94c2..ce09fa1586 100644
--- a/activesupport/test/evented_file_update_checker_test.rb
+++ b/activesupport/test/evented_file_update_checker_test.rb
@@ -78,31 +78,29 @@ class EventedFileUpdateCheckerTest < ActiveSupport::TestCase
end
test "updated should become true when nonexistent directory is added later" do
- Dir.mktmpdir do |dir|
- watched_dir = File.join(dir, "app")
- unwatched_dir = File.join(dir, "node_modules")
- not_exist_watched_dir = File.join(dir, "test")
+ watched_dir = File.join(tmpdir, "app")
+ unwatched_dir = File.join(tmpdir, "node_modules")
+ not_exist_watched_dir = File.join(tmpdir, "test")
- Dir.mkdir(watched_dir)
- Dir.mkdir(unwatched_dir)
+ Dir.mkdir(watched_dir)
+ Dir.mkdir(unwatched_dir)
- checker = new_checker([], watched_dir => ".rb", not_exist_watched_dir => ".rb") { }
+ checker = new_checker([], watched_dir => ".rb", not_exist_watched_dir => ".rb") { }
- FileUtils.touch(File.join(watched_dir, "a.rb"))
- wait
- assert_predicate checker, :updated?
- assert checker.execute_if_updated
+ FileUtils.touch(File.join(watched_dir, "a.rb"))
+ wait
+ assert_predicate checker, :updated?
+ assert checker.execute_if_updated
- Dir.mkdir(not_exist_watched_dir)
- wait
- assert_predicate checker, :updated?
- assert checker.execute_if_updated
+ Dir.mkdir(not_exist_watched_dir)
+ wait
+ assert_predicate checker, :updated?
+ assert checker.execute_if_updated
- FileUtils.touch(File.join(unwatched_dir, "a.rb"))
- wait
- assert_not_predicate checker, :updated?
- assert_not checker.execute_if_updated
- end
+ FileUtils.touch(File.join(unwatched_dir, "a.rb"))
+ wait
+ assert_not_predicate checker, :updated?
+ assert_not checker.execute_if_updated
end
end