Add #unfreeze_time to ActiveSupport::Testing::TimeHelpers

This commit is contained in:
ryanwhocodes 2018-09-07 10:09:46 +01:00
parent 12b32d8049
commit 36e6571a40
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,9 @@
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
The alias is provided for symmetry with `freeze_time`.
*Ryan Davidson*
* Add support for tracing constant autoloads. Just throw
ActiveSupport::Dependencies.logger = Rails.logger

View File

@ -158,7 +158,7 @@ module ActiveSupport
end
# Returns the current time back to its original state, by removing the stubs added by
# +travel+ and +travel_to+.
# +travel+, +travel_to+ and +freeze_time+.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44)
@ -168,6 +168,7 @@ module ActiveSupport
def travel_back
simple_stubs.unstub_all!
end
alias_method :unfreeze_time, :travel_back
# Calls +travel_to+ with +Time.now+.
#

View File

@ -186,4 +186,8 @@ class TimeTravelTest < ActiveSupport::TestCase
assert_operator expected_time.to_s(:db), :<, Time.now.to_s(:db)
end
def test_time_helper_unfreeze_time
assert_equal method(:travel_back), method(:unfreeze_time)
end
end