Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7edc8d96
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7edc8d96
编写于
11月 11, 2015
作者:
X
Xavier Noria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modernizes the test definitions in the file monitors suite
上级
f3516f17
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
16 deletion
+17
-16
activesupport/test/file_update_checker_shared_tests.rb
activesupport/test/file_update_checker_shared_tests.rb
+17
-16
未找到文件。
activesupport/test/file_update_checker_shared_tests.rb
浏览文件 @
7edc8d96
require
'fileutils'
module
FileUpdateCheckerSharedTests
extend
ActiveSupport
::
Testing
::
Declarative
include
FileUtils
def
tmpdir
...
...
@@ -19,7 +20,7 @@ def teardown
FileUtils
.
rm_rf
(
@tmpdir
)
if
@tmpdir
end
def
test_should_not_execute_the_block_if_no_paths_are_given
test
'should not execute the block if no paths are given'
do
i
=
0
checker
=
new_checker
{
i
+=
1
}
...
...
@@ -28,7 +29,7 @@ def test_should_not_execute_the_block_if_no_paths_are_given
assert_equal
0
,
i
end
def
test_should_not_execute_the_block_if_no_files_change
test
'should not execute the block if no files change'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -39,7 +40,7 @@ def test_should_not_execute_the_block_if_no_files_change
assert_equal
0
,
i
end
def
test_should_execute_the_block_once_when_files_are_created
test
'should execute the block once when files are created'
do
i
=
0
checker
=
new_checker
(
tmpfiles
)
{
i
+=
1
}
...
...
@@ -50,7 +51,7 @@ def test_should_execute_the_block_once_when_files_are_created
assert_equal
1
,
i
end
def
test_should_execute_the_block_once_when_files_are_modified
test
'should execute the block once when files are modified'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -63,7 +64,7 @@ def test_should_execute_the_block_once_when_files_are_modified
assert_equal
1
,
i
end
def
test_should_execute_the_block_once_when_files_are_deleted
test
'should execute the block once when files are deleted'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -77,7 +78,7 @@ def test_should_execute_the_block_once_when_files_are_deleted
end
def
test_updated_should_become_true_when_watched_files_are_created
test
'updated should become true when watched files are created'
do
i
=
0
checker
=
new_checker
(
tmpfiles
)
{
i
+=
1
}
...
...
@@ -89,7 +90,7 @@ def test_updated_should_become_true_when_watched_files_are_created
end
def
test_updated_should_become_true_when_watched_files_are_modified
test
'updated should become true when watched files are modified'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -102,7 +103,7 @@ def test_updated_should_become_true_when_watched_files_are_modified
assert
checker
.
updated?
end
def
test_updated_should_become_true_when_watched_files_are_deleted
test
'updated should become true when watched files are deleted'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -115,7 +116,7 @@ def test_updated_should_become_true_when_watched_files_are_deleted
assert
checker
.
updated?
end
def
test_should_be_robust_to_handle_files_with_wrong_modified_time
test
'should be robust to handle files with wrong modified time'
do
i
=
0
FileUtils
.
touch
(
tmpfiles
)
...
...
@@ -132,7 +133,7 @@ def test_should_be_robust_to_handle_files_with_wrong_modified_time
assert_equal
1
,
i
end
def
test_should_cache_updated_result_until_execute
test
'should cache updated result until execute'
do
i
=
0
checker
=
new_checker
(
tmpfiles
)
{
i
+=
1
}
...
...
@@ -145,7 +146,7 @@ def test_should_cache_updated_result_until_execute
assert
!
checker
.
updated?
end
def
test_should_execute_the_block_if_files_change_in_a_watched_directory_one_extension
test
'should execute the block if files change in a watched directory one extension'
do
i
=
0
checker
=
new_checker
([],
tmpdir
=>
:rb
)
{
i
+=
1
}
...
...
@@ -156,7 +157,7 @@ def test_should_execute_the_block_if_files_change_in_a_watched_directory_one_ext
assert_equal
1
,
i
end
def
test_should_execute_the_block_if_files_change_in_a_watched_directory_several_extensions
test
'should execute the block if files change in a watched directory several extensions'
do
i
=
0
checker
=
new_checker
([],
tmpdir
=>
[
:rb
,
:txt
])
{
i
+=
1
}
...
...
@@ -172,7 +173,7 @@ def test_should_execute_the_block_if_files_change_in_a_watched_directory_several
assert_equal
2
,
i
end
def
test_should_not_execute_the_block_if_the_file_extension_is_not_watched
test
'should not execute the block if the file extension is not watched'
do
i
=
0
checker
=
new_checker
([],
tmpdir
=>
:txt
)
{
i
+=
1
}
...
...
@@ -183,7 +184,7 @@ def test_should_not_execute_the_block_if_the_file_extension_is_not_watched
assert_equal
0
,
i
end
def
test_does_not_assume_files_exist_on_instantiation
test
'does not assume files exist on instantiation'
do
i
=
0
non_existing
=
tmpfile
(
'non_existing.rb'
)
...
...
@@ -195,7 +196,7 @@ def test_does_not_assume_files_exist_on_instantiation
assert_equal
1
,
i
end
def
test_detects_files_in_new_subdirectories
test
'detects files in new subdirectories'
do
i
=
0
checker
=
new_checker
([],
tmpdir
=>
:rb
)
{
i
+=
1
}
...
...
@@ -213,7 +214,7 @@ def test_detects_files_in_new_subdirectories
assert_equal
1
,
i
end
def
test_looked_up_extensions_are_inherited_in_subdirectories_not_listening_to_them
test
'looked up extensions are inherited in subdirectories not listening to them'
do
i
=
0
subdir
=
tmpfile
(
'subdir'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录