diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-21 17:44:16 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-06-22 09:44:41 +0000 |
commit | a651903a868d2cefd517b3a31025af443a35b8a9 (patch) | |
tree | d5fc093d4d4908e4a095040370605c4e504b4588 /test/rubygems/test_gem_update_suggestion.rb | |
parent | 67ab8b4346f69d80ef6563b6269355adc41c472c (diff) |
[rubygems/rubygems] Prefer `assert_predicate` over mere `assert`
https://github.com/rubygems/rubygems/commit/0d10063824
Diffstat (limited to 'test/rubygems/test_gem_update_suggestion.rb')
-rw-r--r-- | test/rubygems/test_gem_update_suggestion.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/rubygems/test_gem_update_suggestion.rb b/test/rubygems/test_gem_update_suggestion.rb index 835a2d84f1..57de77e063 100644 --- a/test/rubygems/test_gem_update_suggestion.rb +++ b/test/rubygems/test_gem_update_suggestion.rb @@ -68,7 +68,7 @@ class TestUpdateSuggestion < Gem::TestCase def test_eglible_for_update with_eglible_environment(cmd: @cmd) do Time.stub :now, 123_456_789 do - assert @cmd.eglible_for_update? + assert_predicate @cmd, :eglible_for_update? assert_equal 123_456_789, Gem.configuration.last_update_check # test last check is written to config file @@ -85,7 +85,7 @@ class TestUpdateSuggestion < Gem::TestCase # is not released yet and stored 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? + refute_predicate @cmd, :eglible_for_update? assert_equal @start_time, Gem.configuration.last_update_check end end @@ -99,7 +99,7 @@ class TestUpdateSuggestion < Gem::TestCase reset_last_update_check: false ) do Time.stub :now, @start_time + @week do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? assert_equal @start_time + @week, Gem.configuration.last_update_check end end @@ -116,7 +116,7 @@ class TestUpdateSuggestion < Gem::TestCase reset_last_update_check: false ) do Time.stub :now, @start_time + @week + @minute do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? assert_equal @start_time + @week, Gem.configuration.last_update_check end end @@ -126,19 +126,19 @@ class TestUpdateSuggestion < Gem::TestCase with_eglible_environment(cmd: @cmd) do # checking for first time, it is eglible and stored Time.stub :now, @start_time do - assert @cmd.eglible_for_update? + assert_predicate @cmd, :eglible_for_update? 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? + refute_predicate @cmd, :eglible_for_update? 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_predicate @cmd, :eglible_for_update? assert_equal @start_time + @week, Gem.configuration.last_update_check end end @@ -148,7 +148,7 @@ class TestUpdateSuggestion < Gem::TestCase with_eglible_environment(cmd: @cmd) do original_config = Gem.configuration[:prevent_update_suggestion] Gem.configuration[:prevent_update_suggestion] = true - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? ensure Gem.configuration[:prevent_update_suggestion] = original_config end @@ -158,7 +158,7 @@ class TestUpdateSuggestion < Gem::TestCase with_eglible_environment(cmd: @cmd) do original_env = ENV["RUBYGEMS_PREVENT_UPDATE_SUGGESTION"] ENV["RUBYGEMS_PREVENT_UPDATE_SUGGESTION"] = "yes" - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? ensure ENV["RUBYGEMS_PREVENT_UPDATE_SUGGESTION"] = original_env end @@ -166,13 +166,13 @@ class TestUpdateSuggestion < Gem::TestCase def test_eglible_for_update_non_tty with_eglible_environment(tty: false, cmd: @cmd) do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? end end def test_eglible_for_update_for_prerelease with_eglible_environment(rubygems_version: Gem::Version.new("1.0.0-rc1"), cmd: @cmd) do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? end end @@ -180,7 +180,7 @@ class TestUpdateSuggestion < Gem::TestCase with_eglible_environment(cmd: @cmd) do original_disable = Gem.disable_system_update_message Gem.disable_system_update_message = "disabled" - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? ensure Gem.disable_system_update_message = original_disable end @@ -188,14 +188,14 @@ class TestUpdateSuggestion < Gem::TestCase def test_eglible_for_update_on_ci with_eglible_environment(ci: true, cmd: @cmd) do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? end end def test_eglible_for_update_unwrittable_config with_eglible_environment(cmd: @cmd) do Gem.configuration.stub :state_file_writable?, false do - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? end end end @@ -203,7 +203,7 @@ class TestUpdateSuggestion < Gem::TestCase def test_eglible_for_update_notification_delay with_eglible_environment(cmd: @cmd) do Gem.configuration.last_update_check = Time.now.to_i - refute @cmd.eglible_for_update? + refute_predicate @cmd, :eglible_for_update? end end end |