mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
renames the monitor creation helper
This commit is contained in:
parent
60de179c09
commit
e97200405e
3 changed files with 11 additions and 11 deletions
|
@ -5,7 +5,7 @@ require 'file_update_checker_with_enumerable_test_cases'
|
||||||
class FileEventedUpdateCheckerTest < ActiveSupport::TestCase
|
class FileEventedUpdateCheckerTest < ActiveSupport::TestCase
|
||||||
include FileUpdateCheckerWithEnumerableTestCases
|
include FileUpdateCheckerWithEnumerableTestCases
|
||||||
|
|
||||||
def build_new_watcher(files=[], dirs={}, &block)
|
def new_checker(files=[], dirs={}, &block)
|
||||||
ActiveSupport::FileEventedUpdateChecker.new(files, dirs, &block)
|
ActiveSupport::FileEventedUpdateChecker.new(files, dirs, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'file_update_checker_with_enumerable_test_cases'
|
||||||
class FileUpdateCheckerTest < ActiveSupport::TestCase
|
class FileUpdateCheckerTest < ActiveSupport::TestCase
|
||||||
include FileUpdateCheckerWithEnumerableTestCases
|
include FileUpdateCheckerWithEnumerableTestCases
|
||||||
|
|
||||||
def build_new_watcher(files=[], dirs={}, &block)
|
def new_checker(files=[], dirs={}, &block)
|
||||||
ActiveSupport::FileUpdateChecker.new(files, dirs, &block)
|
ActiveSupport::FileUpdateChecker.new(files, dirs, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_not_execute_the_block_if_no_paths_are_given
|
def test_should_not_execute_the_block_if_no_paths_are_given
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher { i += 1 }
|
checker = new_checker { i += 1 }
|
||||||
|
|
||||||
assert !checker.execute_if_updated
|
assert !checker.execute_if_updated
|
||||||
assert_equal 0, i
|
assert_equal 0, i
|
||||||
|
@ -30,7 +30,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_not_invoke_the_block_if_no_file_has_changed
|
def test_should_not_invoke_the_block_if_no_file_has_changed
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher(@files) { i += 1 }
|
checker = new_checker(@files) { i += 1 }
|
||||||
|
|
||||||
assert !checker.execute_if_updated
|
assert !checker.execute_if_updated
|
||||||
assert_equal 0, i
|
assert_equal 0, i
|
||||||
|
@ -39,7 +39,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_invoke_the_block_if_a_file_has_changed
|
def test_should_invoke_the_block_if_a_file_has_changed
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher(@files) { i += 1 }
|
checker = new_checker(@files) { i += 1 }
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
touch(@files)
|
touch(@files)
|
||||||
|
@ -52,7 +52,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_updated_should_become_true_when_watched_files_are_deleted
|
def test_updated_should_become_true_when_watched_files_are_deleted
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
watcher = build_new_watcher(@files) { i += 1 }
|
watcher = new_checker(@files) { i += 1 }
|
||||||
assert !watcher.updated?
|
assert !watcher.updated?
|
||||||
|
|
||||||
rm_f(@files)
|
rm_f(@files)
|
||||||
|
@ -64,7 +64,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_be_robust_enough_to_handle_deleted_files
|
def test_should_be_robust_enough_to_handle_deleted_files
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher(@files) { i += 1 }
|
checker = new_checker(@files) { i += 1 }
|
||||||
|
|
||||||
rm_f(@files)
|
rm_f(@files)
|
||||||
wait
|
wait
|
||||||
|
@ -80,7 +80,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
time = Time.mktime(now.year + 1, now.month, now.day) # wrong mtime from the future
|
time = Time.mktime(now.year + 1, now.month, now.day) # wrong mtime from the future
|
||||||
File.utime(time, time, @files[0])
|
File.utime(time, time, @files[0])
|
||||||
|
|
||||||
checker = build_new_watcher(@files) { i += 1 }
|
checker = new_checker(@files) { i += 1 }
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
touch(@files[1..-1])
|
touch(@files[1..-1])
|
||||||
|
@ -93,7 +93,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_cache_updated_result_until_execute
|
def test_should_cache_updated_result_until_execute
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher(@files) { i += 1 }
|
checker = new_checker(@files) { i += 1 }
|
||||||
assert !checker.updated?
|
assert !checker.updated?
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -108,7 +108,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_invoke_the_block_if_a_watched_dir_changes
|
def test_should_invoke_the_block_if_a_watched_dir_changes
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher([], @tmpdir => :rb) { i += 1 }
|
checker = new_checker([], @tmpdir => :rb) { i += 1 }
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
touch(@files)
|
touch(@files)
|
||||||
|
@ -121,7 +121,7 @@ module FileUpdateCheckerWithEnumerableTestCases
|
||||||
def test_should_not_invoke_the_block_if_a_watched_dir_does_not_change
|
def test_should_not_invoke_the_block_if_a_watched_dir_does_not_change
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
checker = build_new_watcher([], @tmpdir => :txt) { i += 1 }
|
checker = new_checker([], @tmpdir => :txt) { i += 1 }
|
||||||
|
|
||||||
touch(@files)
|
touch(@files)
|
||||||
wait
|
wait
|
||||||
|
|
Loading…
Reference in a new issue