aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@github.com>2019-03-15 14:20:41 -0700
committerGitHub <noreply@github.com>2019-03-15 14:20:41 -0700
commit233927965d0bd79752274bbc7394d21efeda54c0 (patch)
treeb35c0c5072ef6752129f3c556544241e8f47d062 /activesupport
parentd7e4cb87d3e3aa2aef7d8688fa1e7984337d1cbb (diff)
parentdbfe5c6ac4431c50293183f4561150e6c2ce43ad (diff)
downloadrails-233927965d0bd79752274bbc7394d21efeda54c0.tar.gz
rails-233927965d0bd79752274bbc7394d21efeda54c0.tar.bz2
rails-233927965d0bd79752274bbc7394d21efeda54c0.zip
Merge pull request #35628 from jhawthorn/file_update_any_extension
Match evented checker behavior on dir with no exts
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb4
-rw-r--r--activesupport/test/file_update_checker_shared_tests.rb12
2 files changed, 15 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb
index 54bc5c0ae5..3893b0de0e 100644
--- a/activesupport/lib/active_support/evented_file_update_checker.rb
+++ b/activesupport/lib/active_support/evented_file_update_checker.rb
@@ -131,7 +131,9 @@ module ActiveSupport
ext = @ph.normalize_extension(file.extname)
file.dirname.ascend do |dir|
- if @dirs.fetch(dir, []).include?(ext)
+ matching = @dirs[dir]
+
+ if matching && (matching.empty? || matching.include?(ext))
break true
elsif dir == @lcsp || dir.root?
break false
diff --git a/activesupport/test/file_update_checker_shared_tests.rb b/activesupport/test/file_update_checker_shared_tests.rb
index 72683816b3..84d89fa0a7 100644
--- a/activesupport/test/file_update_checker_shared_tests.rb
+++ b/activesupport/test/file_update_checker_shared_tests.rb
@@ -186,6 +186,18 @@ module FileUpdateCheckerSharedTests
assert_equal 1, i
end
+ test "should execute the block if files change in a watched directory any extensions" do
+ i = 0
+
+ checker = new_checker([], tmpdir => []) { i += 1 }
+
+ touch(tmpfile("foo.rb"))
+ wait
+
+ assert checker.execute_if_updated
+ assert_equal 1, i
+ end
+
test "should execute the block if files change in a watched directory several extensions" do
i = 0