Skip to content

Commit

Permalink
Merge pull request #207 from azranel/add_unfreeze_alias
Browse files Browse the repository at this point in the history
Timecop#unfreeze - Add alias for Timecop#return
  • Loading branch information
travisjeffery authored Sep 10, 2019
2 parents 736c647 + 6fe3c70 commit d860c3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/timecop/timecop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def return(&block)
nil
end
end
alias :unfreeze :return

def return_to_baseline
instance.send(:return_to_baseline)
Expand Down
6 changes: 6 additions & 0 deletions test/timecop_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d860c3f

Please sign in to comment.