From 57693d1362dcde9e0e32689255a22414488e1335 Mon Sep 17 00:00:00 2001 From: Krekoten' Marjan Date: Mon, 30 Aug 2010 22:50:44 +0300 Subject: Make ActiveSupport::Duration#method_missing delegate blocks to value [#5498 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/test/core_ext/duration_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport/test/core_ext/duration_test.rb') diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 8469f78566..b6456f0a30 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -129,6 +129,14 @@ class DurationTest < ActiveSupport::TestCase 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') -- cgit v1.2.3