1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/application/watcher_test.rb
yuuji.yaginuma 81befcf267 Correctly classify the files and directories that pass to watcher
Currently, autoload paths pass to the watcher as directories. If using evented
watcher, this possibly pass as it is to `Listen`.
But autoload paths include files and `Listen` raise an error when was passed
file. So, it is necessary to classify files and directories correctly.

Fixes #37011.
2019-09-02 11:22:39 +09:00

28 lines
680 B
Ruby

# frozen_string_literal: true
require "isolation/abstract_unit"
module ApplicationTests
class WatcherTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
setup :build_app
teardown :teardown_app
def app
@app ||= Rails.application
end
test "watchable_args classifies files included in autoload path" do
add_to_config <<-RUBY
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
RUBY
app_file "app/README.md", ""
require "#{rails_root}/config/environment"
files, _ = Rails.application.watchable_args
assert_includes files, "#{rails_root}/app/README.md"
end
end
end