提交 c98e08df 编写于 作者: A Arthur Nogueira Neves 提交者: GitHub

explicitly require `listen` in `EventedFileUpdateCheckerTest` (#27867)

Currently, executing the `test_initialize_raises_an_ArgumentError_if_no_block_given`
test alone will result in an error.

```
$ ./bin/test test/evented_file_update_checker_test.rb -n test_initialize_raises_an_ArgumentError_if_no_block_given
Run options: -n test_initialize_raises_an_ArgumentError_if_no_block_given --seed 6692

# Running:

E

Error:
EventedFileUpdateCheckerTest#test_initialize_raises_an_ArgumentError_if_no_block_given:
NameError: uninitialized constant EventedFileUpdateCheckerTest::Listen
    rails/activesupport/test/evented_file_update_checker_test.rb:21:in `teardown'
```

This is because if do not specify a file or directory for
`EventedFileUpdateChecker`, do not require `listen`, and using listen
method in teardown.
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/evented_file_update_checker.rb#L53..L65

Therefore, added listen's require to avoid errors.
......@@ -7,6 +7,7 @@ class EventedFileUpdateCheckerTest < ActiveSupport::TestCase
def setup
skip if ENV["LISTEN"] == "0"
require "listen"
super
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册