Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
d1d98f3a
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,发现更多精彩内容 >>
未验证
提交
d1d98f3a
编写于
5月 02, 2020
作者:
X
Xavier Noria
提交者:
GitHub
5月 02, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #39116 from kamipo/fix_missing_helper_error
Fix `modules_for_helpers` to will raise `MissingHelperError`
上级
298c6481
4642ca96
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
16 deletion
+17
-16
actionview/test/abstract_unit.rb
actionview/test/abstract_unit.rb
+13
-2
actionview/test/actionpack/abstract/helper_test.rb
actionview/test/actionpack/abstract/helper_test.rb
+4
-14
未找到文件。
actionview/test/abstract_unit.rb
浏览文件 @
d1d98f3a
# frozen_string_literal: true
$:
.
unshift
File
.
expand_path
(
"lib"
,
__dir__
)
$:
.
unshift
File
.
expand_path
(
"fixtures/helpers"
,
__dir__
)
$:
.
unshift
File
.
expand_path
(
"fixtures/alternate_helpers"
,
__dir__
)
ENV
[
"TMPDIR"
]
=
File
.
expand_path
(
"tmp"
,
__dir__
)
...
...
@@ -23,6 +21,19 @@
require
"active_support/dependencies"
require
"active_model"
module
ActionViewTestSuiteUtils
def
self
.
require_helpers
(
helpers_dirs
)
Array
(
helpers_dirs
).
each
do
|
helpers_dir
|
Dir
.
glob
(
"
#{
helpers_dir
}
/**/*_helper.rb"
)
do
|
helper_file
|
require
helper_file
end
end
end
end
ActionViewTestSuiteUtils
.
require_helpers
(
"
#{
__dir__
}
/fixtures/helpers"
)
ActionViewTestSuiteUtils
.
require_helpers
(
"
#{
__dir__
}
/fixtures/alternate_helpers"
)
ActiveSupport
::
Dependencies
.
hook!
Thread
.
abort_on_exception
=
true
...
...
actionview/test/actionpack/abstract/helper_test.rb
浏览文件 @
d1d98f3a
...
...
@@ -79,10 +79,10 @@ def test_helpers_with_symbol
end
def
test_declare_missing_helper
e
=
assert_raise
AbstractController
::
Helpers
::
MissingHelper
Error
do
e
=
assert_raise
Name
Error
do
AbstractHelpers
.
helper
:missing
end
assert_equal
"
helpers/missing_helper.rb"
,
e
.
path
assert_equal
"
uninitialized constant MissingHelper"
,
e
.
message
end
def
test_helpers_with_module_through_block
...
...
@@ -109,19 +109,9 @@ def test_includes_controller_default_helper
end
class
InvalidHelpersTest
<
ActiveSupport
::
TestCase
def
test_controller_raise_error_about_real_require_problem
e
=
assert_raise
(
LoadError
)
{
AbstractInvalidHelpers
.
helper
(
:invalid_require
)
}
assert_equal
"No such file to load -- very_invalid_file_name.rb"
,
e
.
message
end
def
test_controller_raise_error_about_missing_helper
e
=
assert_raise
(
AbstractController
::
Helpers
::
MissingHelperError
)
{
AbstractInvalidHelpers
.
helper
(
:missing
)
}
assert_equal
"Missing helper file helpers/missing_helper.rb"
,
e
.
message
end
def
test_missing_helper_error_has_the_right_path
e
=
assert_raise
(
AbstractController
::
Helpers
::
MissingHelperError
)
{
AbstractInvalidHelpers
.
helper
(
:missing
)
}
assert_equal
"helpers/missing_helper.rb"
,
e
.
path
e
=
assert_raise
(
NameError
)
{
AbstractInvalidHelpers
.
helper
(
:missing
)
}
assert_equal
"uninitialized constant MissingHelper"
,
e
.
message
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录