diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 1acf08efe98b1749a14dc57c1809cabac38164be..297889542e77babb034b0b22f634e61e9007ee01 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -341,7 +341,7 @@ def require_environment! #:nodoc: end def routes_reloader #:nodoc: - @routes_reloader ||= RoutesReloader.new(file_watcher: config.file_watcher) + @routes_reloader ||= RoutesReloader.new end # Returns an array of file paths appended with a hash of diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index 7f86bef5afae49dcf3c5912454227ecaf3d398a3..10703622538442d20f92d72958699c4bd5661a98 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -9,11 +9,10 @@ class RoutesReloader attr_accessor :eager_load delegate :execute_if_updated, :execute, :updated?, to: :updater - def initialize(file_watcher: ActiveSupport::FileUpdateChecker) + def initialize @paths = [] @route_sets = [] @eager_load = false - @file_watcher = file_watcher end def reload! @@ -27,7 +26,7 @@ def reload! private def updater - @updater ||= @file_watcher.new(paths) { reload! } + @updater ||= ActiveSupport::FileUpdateChecker.new(paths) { reload! } end def clear! diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb index 6b5357453f765582379acf79e5f194759b55099f..9ab400acfcbd944ed891b9ce28b0fd669c0bfd9e 100644 --- a/railties/test/application/loading_test.rb +++ b/railties/test/application/loading_test.rb @@ -184,8 +184,11 @@ def self.counter; 2; end test "does not reload constants on development if custom file watcher always returns false" do add_to_config <<-RUBY config.cache_classes = false - config.file_watcher = Class.new(ActiveSupport::FileUpdateChecker) do + config.file_watcher = Class.new do + def initialize(*); end def updated?; false; end + def execute; end + def execute_if_updated; false; end end RUBY