Skip to content
This repository
Browse code

make stubbing Time.now easier

  • Loading branch information...
commit 0ae5807fa34a625d0d9932242ea121f6f7cdbf20 1 parent 8d87d5c
Aaron Patterson tenderlove authored

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. +7 1 activesupport/lib/active_support/values/time_zone.rb
8 activesupport/lib/active_support/values/time_zone.rb
@@ -282,7 +282,7 @@ def parse(str, now=now)
282 282 # Time.zone = 'Hawaii' # => "Hawaii"
283 283 # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
284 284 def now
285   - Time.now.utc.in_time_zone(self)
  285 + time_now.utc.in_time_zone(self)
286 286 end
287 287
288 288 # Return the current date in this time zone.
@@ -391,5 +391,11 @@ def lazy_zones_map
391 391 end
392 392 end
393 393 end
  394 +
  395 + private
  396 +
  397 + def time_now
  398 + Time.now
  399 + end
394 400 end
395 401 end

0 comments on commit 0ae5807

Please sign in to comment.
Something went wrong with that request. Please try again.