aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/evented_file_update_checker_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #36340 from jhawthorn/evented_file_checker_symlinkKasper Timm Hansen2019-05-241-20/+36
|\ | | | | Fix EventedFileUpdateChecker through a symlink
| * Fix EventedFileUpdateChecker through a symlinkJohn Hawthorn2019-05-231-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | On MacOS, Dir.tmpdir gives me a folder inside "/var/folders/". However, /var is a symlink to /private/var. Previously, the nonexistent directory test would fail because it was initialized with /var/folders/... but the filenames from listen would be the realpaths. This commit normalizes the dirs by calling realpath on them if they exist. This is done on boot!, so it will work with newly directories through the symlink.
| * Use existing tmpdir in evented_file_update_testJohn Hawthorn2019-05-231-20/+18
| | | | | | | | | | The common include of this test creates a tmpdir, we should use that for consistency.
* | Delete evented_file_update_checker existing_parentJohn Hawthorn2019-05-231-8/+0
|/ | | | This is no longer used as of caa3cc8868206f8109e0d633efb09d31e94ef635
* Do not add parent directory to file system monitoringyuuji.yaginuma2018-12-181-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `EventedFileUpdateChecker` will search the parent directory if the specified directory does not exist. Since `test/mailers/previews` is included in the watch target by default, if there is no test directory (e.g. using `rspec`), the Rails root directory will be included in the watch target. ``` $ rails new app $ cd app $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" false $ rm -rf test $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" true ``` This causes `node_modules` to be included in watch target. Adding parent directories to watch target may include unexpected directories. In order to avoid this, fixed that parents of nonexistent directories are not added to the watch targets, instead checking that the directory exists when checking changes. Related to #32700. [Matthew Draper & Yuji Yaginuma]
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-5/+5
|
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* explicitly require `listen` in `EventedFileUpdateCheckerTest`yuuji.yaginuma2017-02-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* rm rm_f that is not in useAkira Matsuda2017-01-181-5/+0
|
* Merge pull request #26830 from headius/mask_forking_fsevent_test_on_jrubyRafael Mendonça França2016-10-201-0/+2
| | | | Mask forking filesystem event on JRuby.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-28/+28
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Test how evented file checker handles forksschneems2016-06-081-1/+42
| | | | | | | Pretty proud of this. We are testing distributed processes synchronized via pipes which makes it deterministic. Pretty cool. We boot a listener in the parent process we then fork. Before we touch the file we verify the fork is booted using pipes. Then the parent process will touch the file while the fork waits on a pipe. Once the parent process signals that the file has been touched we continue inside of the fork.
* EventedFileUpdateChecker boots once per processschneems2016-06-061-1/+2
| | | | | | | | | | We need one file checker booted per process as talked about in #24990. Before we do a check to see if any updates have been registered by the listener we first check to make sure that the current process has booted a listener. We are intentionally not starting a listener when the checker is created. This way we can avoid #25259 in which puma warns of multiple threads created before fork. As written the listener for each process will be invoked by the `ActionDispatch::Executor` middleware when the `updated?` method is called. This is the first middleware on the stack and will be invoked before application code is read into memory. The downside of this approach is that the API is a little less obvious. I.e. that you have to call `updated?` to get the listener to start is not intuitive. We could make `boot!` not private if we want to make the API a little nicer. Alternatively we could boot when the checker is initialized however this reintroduces the puma threads warning, and also means that in cases of `rails server` or when using `preload!` that we have extra threads notifying of changes on a process that we don't care about. [close #24990] [close #25259]
* renames AS::FileEventedUpdateChecker to AS::EventedFileUpdateCheckerXavier Noria2015-12-091-0/+155
Better English.