From b9fcce3944653db5eb49119c134e8525e91f7aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 17 Oct 2014 15:52:32 -0300 Subject: Merge pull request #17302 from claudiob/replace-slower-block-call-with-faster-yield Replace (slower) block.call with (faster) yield --- activesupport/lib/active_support/testing/time_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb index 1112c6e0b1..8c63815660 100644 --- a/activesupport/lib/active_support/testing/time_helpers.rb +++ b/activesupport/lib/active_support/testing/time_helpers.rb @@ -90,7 +90,7 @@ module ActiveSupport # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 # end # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - def travel_to(date_or_time, &block) + def travel_to(date_or_time) if date_or_time.is_a?(Date) && !date_or_time.is_a?(DateTime) now = date_or_time.midnight.to_time else @@ -102,7 +102,7 @@ module ActiveSupport if block_given? begin - block.call + yield ensure travel_back end -- cgit v1.2.3