From 6fe3c7042cde1710fca1ab2dc7482044f2c045ce Mon Sep 17 00:00:00 2001 From: azranel Date: Tue, 18 Jul 2017 13:18:25 +0300 Subject: [PATCH] Add alias for Timecop#return --- lib/timecop/timecop.rb | 1 + test/timecop_test.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/timecop/timecop.rb b/lib/timecop/timecop.rb index afd9f807..7e417462 100644 --- a/lib/timecop/timecop.rb +++ b/lib/timecop/timecop.rb @@ -93,6 +93,7 @@ def return(&block) nil end end + alias :unfreeze :return def return_to_baseline instance.send(:return_to_baseline) diff --git a/test/timecop_test.rb b/test/timecop_test.rb index 232446a0..4fb67412 100644 --- a/test/timecop_test.rb +++ b/test/timecop_test.rb @@ -37,6 +37,12 @@ def test_freeze_then_return_unsets_mock_time assert_nil Time.send(:mock_time) end + def test_freeze_then_unfreeze_unsets_mock_time + Timecop.freeze(1) + Timecop.unfreeze + assert_nil Time.send(:mock_time) + end + def test_travel_then_return_unsets_mock_time Timecop.travel(1) Timecop.return