From 0ae5807fa34a625d0d9932242ea121f6f7cdbf20 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 16 Mar 2012 10:36:18 -0700 Subject: make stubbing Time.now easier --- activesupport/lib/active_support/values/time_zone.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index bfbb838ea7..1dfbcd11b0 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -282,7 +282,7 @@ module ActiveSupport # Time.zone = 'Hawaii' # => "Hawaii" # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00 def now - Time.now.utc.in_time_zone(self) + time_now.utc.in_time_zone(self) end # Return the current date in this time zone. @@ -391,5 +391,11 @@ module ActiveSupport end end end + + private + + def time_now + Time.now + end end end -- cgit v1.2.3