提交 4d641a33 编写于 作者: R Ryuta Kamizono

Fix `helper_method` in `ActionView::TestCase` to allow keyword arguments

上级 12e48544
......@@ -75,8 +75,9 @@ def helper_method(*methods)
methods.flatten.each do |method|
_helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1
def #{method}(*args, &block) # def current_user(*args, &block)
_test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block)
_test_case.send(:'#{method}', *args, &block) # _test_case.send(:'current_user', *args, &block)
end # end
ruby2_keywords(:'#{method}') if respond_to?(:ruby2_keywords, true)
end_eval
end
end
......
......@@ -176,14 +176,14 @@ class ViewAssignsTest < ActionView::TestCase
class HelperExposureTest < ActionView::TestCase
helper(Module.new do
def render_from_helper
from_test_case
from_test_case(suffix: "!")
end
end)
test "is able to make methods available to the view" do
assert_equal "Word!", render(partial: "test/from_helper")
end
def from_test_case; "Word!"; end
def from_test_case(suffix: "?"); "Word#{suffix}"; end
helper_method :from_test_case
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册