Skip to content

Commit

Permalink
[rubygems/rubygems] Fix argument order of assert_equal
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Jun 22, 2023
1 parent ddb431c commit 67ab8b4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/rubygems/test_gem_update_suggestion.rb
Expand Up @@ -69,7 +69,7 @@ def test_eglible_for_update
with_eglible_environment(cmd: @cmd) do
Time.stub :now, 123_456_789 do
assert @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, 123_456_789
assert_equal 123_456_789, Gem.configuration.last_update_check

# test last check is written to config file
assert File.read(Gem.configuration.state_file_name).match("123456789")
Expand All @@ -86,7 +86,7 @@ def test_eglible_for_update_is_not_annoying_when_new_version_is_released
with_eglible_environment(cmd: @cmd, rubygems_version: current_version, latest_rubygems_version: latest_version) do
Time.stub :now, @start_time do
refute @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time
assert_equal @start_time, Gem.configuration.last_update_check
end
end

Expand All @@ -100,7 +100,7 @@ def test_eglible_for_update_is_not_annoying_when_new_version_is_released
) do
Time.stub :now, @start_time + @week do
refute @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time + @week
assert_equal @start_time + @week, Gem.configuration.last_update_check
end
end

Expand All @@ -117,7 +117,7 @@ def test_eglible_for_update_is_not_annoying_when_new_version_is_released
) do
Time.stub :now, @start_time + @week + @minute do
refute @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time + @week
assert_equal @start_time + @week, Gem.configuration.last_update_check
end
end
end
Expand All @@ -127,19 +127,19 @@ def test_eglible_for_update_is_not_annoying_when_not_upgraded
# checking for first time, it is eglible and stored
Time.stub :now, @start_time do
assert @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time
assert_equal @start_time, Gem.configuration.last_update_check
end

# checking minute later is not eglible and not stored
Time.stub :now, @start_time + @minute do
refute @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time
assert_equal @start_time, Gem.configuration.last_update_check
end

# checking week later is eglible again and stored
Time.stub :now, @start_time + @week do
assert @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, @start_time + @week
assert_equal @start_time + @week, Gem.configuration.last_update_check
end
end
end
Expand Down

0 comments on commit 67ab8b4

Please sign in to comment.