Skip to content

Commit

Permalink
Added nil param tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjdavis authored and joshuacronemeyer committed Jan 14, 2022
1 parent abaaa1f commit a3454c3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/timecop_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,12 @@ def test_scaling_returns_now_if_no_block_given
t = Time.local(2008, 10, 10, 10, 10, 10)
assert_times_effectively_equal t, Timecop.scale(4, t)
end

def test_scaling_returns_now_if_nil_supplied
assert_times_effectively_equal Time.now, Timecop.scale(nil)
end

def test_scale_raises_when_empty_string_supplied
def test_scaling_raises_when_empty_string_supplied
err = assert_raises(TypeError) do
Timecop.scale("")
end
Expand Down Expand Up @@ -401,6 +405,10 @@ def test_return_temporarily_returns_to_current_time_in_given_block
end
assert_times_effectively_equal(time_after_travel, Time.now)
end

def test_travel_returns_now_if_nil_supplied
assert_times_effectively_equal Time.now, Timecop.travel(nil)
end

def test_travel_time_with_block_returns_the_value_of_the_block
t_future = Time.local(2030, 10, 10, 10, 10, 10)
Expand Down Expand Up @@ -442,6 +450,10 @@ def test_freeze_without_params
end
end
end

def test_freeze_returns_now_if_nil_supplied
assert_times_effectively_equal Time.now, Timecop.freeze(nil)
end

def test_freeze_raises_when_empty_string_supplied
err = assert_raises(ArgumentError) do
Expand Down

0 comments on commit a3454c3

Please sign in to comment.