aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-16 10:36:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-16 10:36:18 -0700
commit0ae5807fa34a625d0d9932242ea121f6f7cdbf20 (patch)
tree63ca4bc5bcb61f59df934567cf39cda25e62738e
parent8d87d5c94708c2d93010083f97244748f96bb9dc (diff)
downloadrails-0ae5807fa34a625d0d9932242ea121f6f7cdbf20.tar.gz
rails-0ae5807fa34a625d0d9932242ea121f6f7cdbf20.tar.bz2
rails-0ae5807fa34a625d0d9932242ea121f6f7cdbf20.zip
make stubbing Time.now easier
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb8
1 files changed, 7 insertions, 1 deletions
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