提交 57693d13 编写于 作者: K Krekoten' Marjan 提交者: José Valim

Make ActiveSupport::Duration#method_missing delegate blocks to value [#5498 state:resolved]

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 dba4efbd
......@@ -99,7 +99,7 @@ def sum(sign, time = ::Time.current) #:nodoc:
private
def method_missing(method, *args, &block) #:nodoc:
value.send(method, *args)
value.send(method, *args, &block)
end
end
end
......@@ -129,6 +129,14 @@ def test_adding_day_across_dst_boundary
assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0)
end
end
def test_delegation_with_block_works
counter = 0
assert_nothing_raised do
1.minute.times {counter += 1}
end
assert_equal counter, 60
end
protected
def with_env_tz(new_tz = 'US/Eastern')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册