diff --git a/Gemfile b/Gemfile index 3d580698de..932ac87e77 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ end # Active Support. gem 'dalli', '>= 2.2.1' -gem 'listen', '~> 3.0.5' +gem 'listen', '~> 3.0.5', require: false # Active Job. group :job do diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb index c1c30b1a86..315be85fb3 100644 --- a/activesupport/lib/active_support/evented_file_update_checker.rb +++ b/activesupport/lib/active_support/evented_file_update_checker.rb @@ -1,4 +1,3 @@ -require 'listen' require 'set' require 'pathname' require 'concurrent/atomic/atomic_boolean' @@ -19,6 +18,10 @@ module ActiveSupport @lcsp = @ph.longest_common_subpath(@dirs.keys) if (dtw = directories_to_watch).any? + # Loading listen triggers warnings. These are originated by a legit + # usage of attr_* macros for private attributes, but adds a lot of noise + # to our test suite. Thus, we lazy load it and disable warnings locally. + silence_warnings { require 'listen' } Listen.to(*dtw, &method(:changed)).start end end