Skip to content

Commit

Permalink
Test exposing the outcome of using destructive methods on a frozen time.
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarburger committed May 27, 2010
1 parent 0573a60 commit dbd59dd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_timecop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ def test_freeze_with_utc_time
end
end
end

def test_destructive_methods_on_frozen_time
# Use any time zone other than UTC.
ENV['TZ'] = 'EST'

t = Time.local(2008, 10, 10, 10, 10, 10)
Timecop.freeze(t) do
assert !Time.now.utc?, "Time#local failed to return a time in the local time zone."

# #utc, #gmt, and #localtime are destructive methods.
Time.now.utc

assert !Time.now.utc?, "Failed to thwart destructive methods."
end
end

def test_recursive_travel_maintains_each_context
t = Time.local(2008, 10, 10, 10, 10, 10)
Expand Down

0 comments on commit dbd59dd

Please sign in to comment.