summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-05 17:06:01 +0900
committergit <svn-admin@ruby-lang.org>2023-04-05 09:50:29 +0000
commite003784fc8bfa527cf21c317741101a713c041c0 (patch)
tree0d69690aec6d5f156ed90241d6beb46e112cc503 /test/rubygems
parent65d27d3c0a1235f04ca90f94e29a7f2ddfd1b574 (diff)
[rubygems/rubygems] util/rubocop -A --only Style/RegexpLiteral
https://github.com/rubygems/rubygems/commit/9264d83421
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_config.rb4
-rw-r--r--test/rubygems/test_gem.rb6
-rw-r--r--test/rubygems/test_gem_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb44
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb2
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb22
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_signout_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb30
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb6
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb6
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb4
-rw-r--r--test/rubygems/test_gem_ext_builder.rb26
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb12
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb20
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb18
-rw-r--r--test/rubygems/test_gem_indexer.rb19
-rw-r--r--test/rubygems/test_gem_installer.rb38
-rw-r--r--test/rubygems/test_gem_package.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb12
-rw-r--r--test/rubygems/test_gem_request.rb6
-rw-r--r--test/rubygems/test_gem_specification.rb12
-rw-r--r--test/rubygems/test_gem_uninstaller.rb24
-rw-r--r--test/rubygems/test_remote_fetch_error.rb2
38 files changed, 208 insertions, 209 deletions
diff --git a/test/rubygems/test_config.rb b/test/rubygems/test_config.rb
index 26f681328f..657624d526 100644
--- a/test/rubygems/test_config.rb
+++ b/test/rubygems/test_config.rb
@@ -16,13 +16,13 @@ class TestGemConfig < Gem::TestCase
path = Gem::TestCase.class_variable_get(:@@good_rake)
ruby, rake = path.shellsplit
assert_equal(Gem.ruby, ruby)
- assert_match(/\/good_rake.rb\z/, rake)
+ assert_match(%r{/good_rake.rb\z}, rake)
end
def test_bad_rake_path_is_escaped
path = Gem::TestCase.class_variable_get(:@@bad_rake)
ruby, rake = path.shellsplit
assert_equal(Gem.ruby, ruby)
- assert_match(/\/bad_rake.rb\z/, rake)
+ assert_match(%r{/bad_rake.rb\z}, rake)
end
end
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 4494231a65..3efc2ddb69 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1254,8 +1254,8 @@ class TestGem < Gem::TestCase
Gem.try_activate "a_file"
end
- assert_match %r{Could not find 'b' }, e.message
- assert_match %r{at: #{a.spec_file}}, e.message
+ assert_match(/Could not find 'b' /, e.message)
+ assert_match(/at: #{a.spec_file}/, e.message)
end
def test_self_try_activate_missing_prerelease
@@ -1275,7 +1275,7 @@ class TestGem < Gem::TestCase
Gem.try_activate "a_file"
end
- assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
+ assert_match(/Could not find 'b' \(= 1.0rc1\)/, e.message)
end
def test_self_try_activate_missing_extensions
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index 09031ac375..98127f3e80 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -102,7 +102,7 @@ class TestGemCommand < Gem::TestCase
@cmd.invoke
end
- assert_match %r{Usage: gem doit}, @ui.output
+ assert_match(/Usage: gem doit/, @ui.output)
end
def test_invoke
@@ -188,7 +188,7 @@ class TestGemCommand < Gem::TestCase
@cmd.invoke "-h"
end
- assert_match %r{Usage: gem doit}, @ui.output
+ assert_match(/Usage: gem doit/, @ui.output)
end
def test_add_option
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index 259beb6b0d..53e3394361 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -231,7 +231,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{^Skipped default gems: b-2}, @ui.output
+ assert_match(/^Skipped default gems: b-2/, @ui.output)
assert_empty @ui.error
end
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 8d7f301a5b..d8e6ba3dec 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -28,7 +28,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
end
assert_match %r{lib/foo\.rb}, @ui.output
- assert_match %r{Rakefile}, @ui.output
+ assert_match(/Rakefile/, @ui.output)
assert_equal "", @ui.error
end
@@ -44,7 +44,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_match %r{lib/foo\.rb}, @ui.output
assert_match %r{lib/bar\.rb}, @ui.output
- assert_match %r{Rakefile}, @ui.output
+ assert_match(/Rakefile/, @ui.output)
assert_equal "", @ui.error
end
@@ -57,8 +57,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
end
end
- assert_match %r{Unable to find gem 'foo' in default gem paths}, @ui.output
- assert_match %r{Directories searched:}, @ui.output
+ assert_match(/Unable to find gem 'foo' in default gem paths/, @ui.output)
+ assert_match(/Directories searched:/, @ui.output)
assert_equal "", @ui.error
end
@@ -72,7 +72,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
end
assert_match %r{lib/foo\.rb}, @ui.output
- assert_match %r{Rakefile}, @ui.output
+ assert_match(/Rakefile/, @ui.output)
assert_equal "", @ui.error
end
@@ -87,7 +87,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
end
assert_match %r{lib/foo\.rb}, @ui.output
- refute_match %r{Rakefile}, @ui.output
+ refute_match(/Rakefile/, @ui.output)
assert_equal "", @ui.error
end
@@ -148,7 +148,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_match %r{lib/foo\.rb}, @ui.output
assert_match %r{lib/bar\.rb}, @ui.output
- assert_match %r{Rakefile}, @ui.output
+ assert_match(/Rakefile/, @ui.output)
assert_equal "", @ui.error
end
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index 9f14ed2e11..f527574c07 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -23,28 +23,28 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{RUBYGEMS VERSION: (\d\.)+\d}, @ui.output
- assert_match %r{RUBY VERSION: \d+\.\d+\.\d+ \(.*\) \[.*\]}, @ui.output
- assert_match %r{INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}},
- @ui.output
- assert_match %r{USER INSTALLATION DIRECTORY: #{Regexp.escape Gem.user_dir}},
- @ui.output
- assert_match %r{RUBYGEMS PREFIX: }, @ui.output
- assert_match %r{RUBY EXECUTABLE:.*#{RbConfig::CONFIG['ruby_install_name']}},
- @ui.output
- assert_match %r{GIT EXECUTABLE: #{@cmd.send(:git_path)}}, @ui.output
- assert_match %r{SYSTEM CONFIGURATION DIRECTORY:}, @ui.output
- assert_match %r{EXECUTABLE DIRECTORY:}, @ui.output
- assert_match %r{RUBYGEMS PLATFORMS:}, @ui.output
- assert_match %r{- #{Gem::Platform.local}}, @ui.output
- assert_match %r{GEM PATHS:}, @ui.output
- assert_match %r{- #{Regexp.escape @gemhome}}, @ui.output
- assert_match %r{GEM CONFIGURATION:}, @ui.output
- assert_match %r{"gemcutter_key" => "\*\*\*\*"}, @ui.output
- assert_match %r{:verbose => }, @ui.output
- assert_match %r{REMOTE SOURCES:}, @ui.output
-
- assert_match %r{- SHELL PATH:}, @ui.output
+ assert_match(/RUBYGEMS VERSION: (\d\.)+\d/, @ui.output)
+ assert_match(/RUBY VERSION: \d+\.\d+\.\d+ \(.*\) \[.*\]/, @ui.output)
+ assert_match(/INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}/,
+ @ui.output)
+ assert_match(/USER INSTALLATION DIRECTORY: #{Regexp.escape Gem.user_dir}/,
+ @ui.output)
+ assert_match(/RUBYGEMS PREFIX: /, @ui.output)
+ assert_match(/RUBY EXECUTABLE:.*#{RbConfig::CONFIG['ruby_install_name']}/,
+ @ui.output)
+ assert_match(/GIT EXECUTABLE: #{@cmd.send(:git_path)}/, @ui.output)
+ assert_match(/SYSTEM CONFIGURATION DIRECTORY:/, @ui.output)
+ assert_match(/EXECUTABLE DIRECTORY:/, @ui.output)
+ assert_match(/RUBYGEMS PLATFORMS:/, @ui.output)
+ assert_match(/- #{Gem::Platform.local}/, @ui.output)
+ assert_match(/GEM PATHS:/, @ui.output)
+ assert_match(/- #{Regexp.escape @gemhome}/, @ui.output)
+ assert_match(/GEM CONFIGURATION:/, @ui.output)
+ assert_match(/"gemcutter_key" => "\*\*\*\*"/, @ui.output)
+ assert_match(/:verbose => /, @ui.output)
+ assert_match(/REMOTE SOURCES:/, @ui.output)
+
+ assert_match(/- SHELL PATH:/, @ui.output)
assert_match %r{- /usr/local/bin$}, @ui.output
assert_match %r{- /usr/bin$}, @ui.output
assert_match %r{- /bin$}, @ui.output
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index fb01667f99..359da0a6d0 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -56,7 +56,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
if Gem::HAVE_OPENSSL
assert_empty err
- refute_match %r{No command found for }, out
+ refute_match(/No command found for /, out)
end
end
end
diff --git a/test/rubygems/test_gem_commands_info_command.rb b/test/rubygems/test_gem_commands_info_command.rb
index 54a87853ef..4e2a8f3622 100644
--- a/test/rubygems/test_gem_commands_info_command.rb
+++ b/test/rubygems/test_gem_commands_info_command.rb
@@ -34,11 +34,11 @@ class TestGemCommandsInfoCommand < Gem::TestCase
end
assert_match %r{#{@gem.name} \(#{@gem.version}\)\n}, @ui.output
- assert_match %r{Authors: #{@gem.authors.join(', ')}\n}, @ui.output
- assert_match %r{Homepage: #{@gem.homepage}\n}, @ui.output
- assert_match %r{License: #{@gem.license}\n}, @ui.output
- assert_match %r{Installed at: #{@gem.base_dir}\n}, @ui.output
- assert_match %r{#{@gem.summary}\n}, @ui.output
+ assert_match(/Authors: #{@gem.authors.join(', ')}\n/, @ui.output)
+ assert_match(/Homepage: #{@gem.homepage}\n/, @ui.output)
+ assert_match(/License: #{@gem.license}\n/, @ui.output)
+ assert_match(/Installed at: #{@gem.base_dir}\n/, @ui.output)
+ assert_match(/#{@gem.summary}\n/, @ui.output)
assert_match "", @ui.error
end
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 2d26f36069..008c3c7e10 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -1067,7 +1067,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
assert_equal 2, e.exit_code
- assert_match %r{Could not find a valid gem 'a' \(= 10.0\)}, @ui.error
+ assert_match(/Could not find a valid gem 'a' \(= 10.0\)/, @ui.error)
end
def test_show_errors_on_failure
diff --git a/test/rubygems/test_gem_commands_mirror.rb b/test/rubygems/test_gem_commands_mirror.rb
index 95f3bbcc9f..2256a3ab33 100644
--- a/test/rubygems/test_gem_commands_mirror.rb
+++ b/test/rubygems/test_gem_commands_mirror.rb
@@ -15,6 +15,6 @@ class TestGemCommandsMirrorCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Install the rubygems-mirror}i, @ui.error
+ assert_match(/Install the rubygems-mirror/i, @ui.error)
end
end
diff --git a/test/rubygems/test_gem_commands_open_command.rb b/test/rubygems/test_gem_commands_open_command.rb
index 9f14353485..2519a20883 100644
--- a/test/rubygems/test_gem_commands_open_command.rb
+++ b/test/rubygems/test_gem_commands_open_command.rb
@@ -50,7 +50,7 @@ class TestGemCommandsOpenCommand < Gem::TestCase
end
end
- assert_match %r{Unable to find gem 'foo'}, @ui.output
+ assert_match(/Unable to find gem 'foo'/, @ui.output)
assert_equal "", @ui.error
end
@@ -63,7 +63,7 @@ class TestGemCommandsOpenCommand < Gem::TestCase
end
end
- assert_match %r{Unable to find gem 'foo'}, @ui.output
+ assert_match(/Unable to find gem 'foo'/, @ui.output)
assert_equal "", @ui.error
end
@@ -92,7 +92,7 @@ class TestGemCommandsOpenCommand < Gem::TestCase
end
end
- assert_match %r{'foo' is a default gem and can't be opened\.}, @ui.output
+ assert_match(/'foo' is a default gem and can't be opened\./, @ui.output)
assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 4911f3c0fb..7aaeb3a672 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -46,11 +46,11 @@ EOF
assert_equal Net::HTTP::Get, @stub_fetcher.last_request.class
assert_equal Gem.configuration.rubygems_api_key, @stub_fetcher.last_request["Authorization"]
- assert_match %r{Owners for gem: freewill}, @stub_ui.output
- assert_match %r{- user1@example.com}, @stub_ui.output
- assert_match %r{- user2@example.com}, @stub_ui.output
- assert_match %r{- user3}, @stub_ui.output
- assert_match %r{- 4}, @stub_ui.output
+ assert_match(/Owners for gem: freewill/, @stub_ui.output)
+ assert_match(/- user1@example.com/, @stub_ui.output)
+ assert_match(/- user2@example.com/, @stub_ui.output)
+ assert_match(/- user3/, @stub_ui.output)
+ assert_match(/- 4/, @stub_ui.output)
end
def test_show_owners_dont_load_objects
@@ -87,8 +87,8 @@ EOF
@cmd.show_owners("freewill")
end
- assert_match %r{Owners for gem: freewill}, @stub_ui.output
- assert_match %r{- user1@example.com}, @stub_ui.output
+ assert_match(/Owners for gem: freewill/, @stub_ui.output)
+ assert_match(/- user1@example.com/, @stub_ui.output)
end
def test_show_owners_setting_up_host
@@ -102,8 +102,8 @@ EOF
@cmd.show_owners("freewill")
end
- assert_match %r{Owners for gem: freewill}, @stub_ui.output
- assert_match %r{- user1@example.com}, @stub_ui.output
+ assert_match(/Owners for gem: freewill/, @stub_ui.output)
+ assert_match(/- user1@example.com/, @stub_ui.output)
end
def test_show_owners_denied
@@ -217,8 +217,8 @@ EOF
end
assert_match add_owner_response, @stub_ui.output
- assert_match %r{Owners for gem: freewill}, @stub_ui.output
- assert_match %r{- user1@example.com}, @stub_ui.output
+ assert_match(/Owners for gem: freewill/, @stub_ui.output)
+ assert_match(/- user1@example.com/, @stub_ui.output)
end
def test_add_owners_key
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb
index be9be4b802..2fb2b1ef9a 100644
--- a/test/rubygems/test_gem_commands_pristine_command.rb
+++ b/test/rubygems/test_gem_commands_pristine_command.rb
@@ -162,7 +162,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
bin_env = Gem.win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
- assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_exec)
+ assert_match(/\A#!\s*#{bin_env}#{ruby_exec}/, File.read(gem_exec))
end
def test_execute_extensions_explicit
@@ -504,7 +504,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
end
- assert_match %r{at least one gem name}, e.message
+ assert_match(/at least one gem name/, e.message)
end
def test_execute_only_executables
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index 7035e778ce..b5458bc7ce 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -56,7 +56,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
@cmd.send_gem(@path)
end
- assert_match %r{Pushing gem to #{@host}...}, @ui.output
+ assert_match(/Pushing gem to #{@host}.../, @ui.output)
assert_equal Net::HTTP::Post, @fetcher.last_request.class
assert_equal Gem.read_binary(@path), @fetcher.last_request.body
@@ -315,7 +315,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
# do not set @host
use_ui(@ui) { @cmd.send_gem(@path) }
- assert_match %r{Pushing gem to #{host}...}, @ui.output
+ assert_match(/Pushing gem to #{host}.../, @ui.output)
assert_equal Net::HTTP::Post, @fetcher.last_request.class
assert_equal Gem.read_binary(@path), @fetcher.last_request.body
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 0a813b519d..8e590df124 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -552,8 +552,8 @@ pl (1 i386-linux)
@cmd.execute
end
- assert_match %r{^a }, @stub_ui.output
- assert_match %r{^pl }, @stub_ui.output
+ assert_match(/^a /, @stub_ui.output)
+ assert_match(/^pl /, @stub_ui.output)
assert_equal "", @stub_ui.error
end
@@ -565,8 +565,8 @@ pl (1 i386-linux)
@cmd.send :show_gems, /a/i
end
- assert_match %r{^a }, @stub_ui.output
- refute_match %r{^pl }, @stub_ui.output
+ assert_match(/^a /, @stub_ui.output)
+ refute_match(/^pl /, @stub_ui.output)
assert_empty @stub_ui.error
end
diff --git a/test/rubygems/test_gem_commands_server_command.rb b/test/rubygems/test_gem_commands_server_command.rb
index 256d27928b..cabb7cf49d 100644
--- a/test/rubygems/test_gem_commands_server_command.rb
+++ b/test/rubygems/test_gem_commands_server_command.rb
@@ -15,6 +15,6 @@ class TestGemCommandsServerCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Install the rubygems-server}i, @ui.error
+ assert_match(/Install the rubygems-server/i, @ui.error)
end
end
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 978c9335ff..6a00a63f65 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -69,7 +69,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.execute
- assert_match %r{\A#!}, File.read(gem_bin_path)
+ assert_match(/\A#!/, File.read(gem_bin_path))
end
def test_execute_no_regenerate_binstubs
@@ -92,7 +92,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.execute
- assert_match %r{\Arequire}, File.read(gem_plugin_path)
+ assert_match(/\Arequire/, File.read(gem_plugin_path))
end
def test_execute_no_regenerate_plugins
@@ -115,7 +115,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.execute
- assert_match %r{\Arequire}, File.read(gem_plugin_path)
+ assert_match(/\Arequire/, File.read(gem_plugin_path))
end
def test_execute_informs_about_installed_executables
@@ -143,10 +143,10 @@ class TestGemCommandsSetupCommand < Gem::TestCase
ruby_exec = sprintf Gem.default_exec_format, "ruby"
bin_env = Gem.win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
- assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_gem_bin_path)
- assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundle_bin_path)
- assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundler_bin_path)
- assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_bin_path)
+ assert_match(/\A#!\s*#{bin_env}#{ruby_exec}/, File.read(default_gem_bin_path))
+ assert_match(/\A#!\s*#{bin_env}#{ruby_exec}/, File.read(default_bundle_bin_path))
+ assert_match(/\A#!\s*#{bin_env}#{ruby_exec}/, File.read(default_bundler_bin_path))
+ assert_match(/\A#!\s*#{bin_env}#{ruby_exec}/, File.read(gem_bin_path))
end
def test_destdir_flag_does_not_try_to_write_to_the_default_gem_home
diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb
index 3e108071ca..15e852cfdb 100644
--- a/test/rubygems/test_gem_commands_signin_command.rb
+++ b/test/rubygems/test_gem_commands_signin_command.rb
@@ -24,14 +24,14 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def test_execute_when_not_already_signed_in
sign_in_ui = util_capture { @cmd.execute }
- assert_match %r{Signed in.}, sign_in_ui.output
+ assert_match(/Signed in./, sign_in_ui.output)
end
def test_execute_when_not_already_signed_in_and_not_preexisting_credentials_folder
FileUtils.rm Gem.configuration.credentials_path
sign_in_ui = util_capture { @cmd.execute }
- assert_match %r{Signed in.}, sign_in_ui.output
+ assert_match(/Signed in./, sign_in_ui.output)
end
def test_execute_when_already_signed_in_with_same_host
@@ -64,8 +64,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase
host = "http://some-gemcutter-compatible-host.org"
sign_in_ui = util_capture(nil, host) { @cmd.execute }
- assert_match %r{Enter your #{host} credentials.}, sign_in_ui.output
- assert_match %r{Signed in.}, sign_in_ui.output
+ assert_match(/Enter your #{host} credentials./, sign_in_ui.output)
+ assert_match(/Signed in./, sign_in_ui.output)
api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
credentials = load_yaml_file Gem.configuration.credentials_path
diff --git a/test/rubygems/test_gem_commands_signout_command.rb b/test/rubygems/test_gem_commands_signout_command.rb
index 4aad19206e..999a14080f 100644
--- a/test/rubygems/test_gem_commands_signout_command.rb
+++ b/test/rubygems/test_gem_commands_signout_command.rb
@@ -17,7 +17,7 @@ class TestGemCommandsSignoutCommand < Gem::TestCase
@sign_out_ui = Gem::MockGemUi.new
use_ui(@sign_out_ui) { @cmd.execute }
- assert_match %r{You have successfully signed out}, @sign_out_ui.output
+ assert_match(/You have successfully signed out/, @sign_out_ui.output)
assert_equal false, File.exist?(Gem.configuration.credentials_path)
end
@@ -25,6 +25,6 @@ class TestGemCommandsSignoutCommand < Gem::TestCase
@sign_out_ui = Gem::MockGemUi.new
use_ui(@sign_out_ui) { @cmd.execute }
- assert_match %r{You are not currently signed in}, @sign_out_ui.error
+ assert_match(/You are not currently signed in/, @sign_out_ui.error)
end
end
diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb
index 1261ebdcd7..454d6ea1c6 100644
--- a/test/rubygems/test_gem_commands_specification_command.rb
+++ b/test/rubygems/test_gem_commands_specification_command.rb
@@ -21,8 +21,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/Gem::Specification/, @ui.output)
+ assert_match(/name: foo/, @ui.output)
assert_equal "", @ui.error
end
@@ -37,10 +37,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
- assert_match %r{version: 0.0.1}, @ui.output
- assert_match %r{version: 0.0.2}, @ui.output
+ assert_match(/Gem::Specification/, @ui.output)
+ assert_match(/name: foo/, @ui.output)
+ assert_match(/version: 0.0.1/, @ui.output)
+ assert_match(/version: 0.0.2/, @ui.output)
assert_equal "", @ui.error
end
@@ -99,8 +99,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/Gem::Specification/, @ui.output)
+ assert_match(/name: foo/, @ui.output)
assert_equal "", @ui.error
end
@@ -131,8 +131,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/Gem::Specification/, @ui.output)
+ assert_match(/name: foo/, @ui.output)
assert_equal "", @ui.error
end
@@ -165,7 +165,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/name: foo/, @ui.output)
end
def test_execute_remote_with_version
@@ -229,7 +229,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/name: foo/, @ui.output)
spec = load_yaml @ui.output
@@ -251,7 +251,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
- assert_match %r{name: foo}, @ui.output
+ assert_match(/name: foo/, @ui.output)
spec = load_yaml @ui.output
@@ -270,8 +270,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
@cmd.execute
end
- assert_match %r{Gem::Specification.new}, @ui.output
- assert_match %r{s.name = "foo"}, @ui.output
+ assert_match(/Gem::Specification.new/, @ui.output)
+ assert_match(/s.name = "foo"/, @ui.output)
assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 2dceb261dc..48c5cadaed 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -496,7 +496,7 @@ WARNING: Use your OS package manager to uninstall vendor gems
end
assert_empty @ui.output
- assert_match %r{Error: unable to successfully uninstall '#{@spec.name}'}, @ui.error
+ assert_match(/Error: unable to successfully uninstall '#{@spec.name}'/, @ui.error)
end
private
diff --git a/test/rubygems/test_gem_commands_which_command.rb b/test/rubygems/test_gem_commands_which_command.rb
index 30f97811c8..cbd5b5ef14 100644
--- a/test/rubygems/test_gem_commands_which_command.rb
+++ b/test/rubygems/test_gem_commands_which_command.rb
@@ -33,8 +33,8 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
assert_equal "", @ui.output
- assert_match %r{Can.t find Ruby library file or shared library directory\n},
- @ui.error
+ assert_match(/Can.t find Ruby library file or shared library directory\n/,
+ @ui.error)
end
def test_execute_one_missing
@@ -51,8 +51,8 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
- assert_match %r{Can.t find Ruby library file or shared library missinglib\n},
- @ui.error
+ assert_match(/Can.t find Ruby library file or shared library missinglib\n/,
+ @ui.error)
end
def test_execute_missing
@@ -65,8 +65,8 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
assert_equal "", @ui.output
- assert_match %r{Can.t find Ruby library file or shared library missinglib\n},
- @ui.error
+ assert_match(/Can.t find Ruby library file or shared library missinglib\n/,
+ @ui.error)
end
def util_foo_bar
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
index 202b064468..0a20617dff 100644
--- a/test/rubygems/test_gem_commands_yank_command.rb
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -55,7 +55,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
end
assert_match %r{Yanking gem from http://example}, @ui.output
- assert_match %r{Successfully yanked}, @ui.output
+ assert_match(/Successfully yanked/, @ui.output)
platform = Gem.platforms[1]
body = @fetcher.last_request.body.split("&").sort
@@ -86,7 +86,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_match "You have enabled multi-factor authentication. Please enter OTP code.", @otp_ui.output
assert_match "Code: ", @otp_ui.output
assert_match %r{Yanking gem from http://example}, @otp_ui.output
- assert_match %r{Successfully yanked}, @otp_ui.output
+ assert_match(/Successfully yanked/, @otp_ui.output)
assert_equal "111111", @fetcher.last_request["OTP"]
end
@@ -141,7 +141,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
end
assert_match %r{Yanking gem from https://other.example}, @ui.output
- assert_match %r{Successfully yanked}, @ui.output
+ assert_match(/Successfully yanked/, @ui.output)
body = @fetcher.last_request.body.split("&").sort
assert_equal %w[gem_name=a version=1.0], body
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 1c30f6e59d..f0044ea1fe 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -587,8 +587,8 @@ class TestGemDependencyInstaller < Gem::TestCase
env = "/\\S+/env" unless Gem.win_platform?
- assert_match %r{\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n},
- File.read(File.join(@gemhome, "bin", "a_bin"))
+ assert_match(/\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n/,
+ File.read(File.join(@gemhome, "bin", "a_bin")))
end
def test_install_force
@@ -904,7 +904,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false
inst.install "a"
- refute_match(%r{This file was generated by RubyGems.},
+ refute_match(/This file was generated by RubyGems./,
File.read(File.join(@gemhome, "bin", "a_bin")))
end
end
diff --git a/test/rubygems/test_gem_dependency_resolution_error.rb b/test/rubygems/test_gem_dependency_resolution_error.rb
index bf99969226..07970ff475 100644
--- a/test/rubygems/test_gem_dependency_resolution_error.rb
+++ b/test/rubygems/test_gem_dependency_resolution_error.rb
@@ -21,7 +21,7 @@ class TestGemDependencyResolutionError < Gem::TestCase
end
def test_message
- assert_match %r{^conflicting dependencies a \(= 1\) and a \(= 2\)$},
- @error.message
+ assert_match(/^conflicting dependencies a \(= 1\) and a \(= 2\)$/,
+ @error.message)
end
end
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 142dfdab00..03d40fa400 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -48,14 +48,14 @@ install:
results = results.join("\n").b
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} clean$}, results
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']}$}, results
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']} clean$/, results)
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']}$/, results)
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']} install$/, results)
unless /nmake/.match?(results)
- assert_match %r{^clean: destination$}, results
- assert_match %r{^all: destination$}, results
- assert_match %r{^install: destination$}, results
+ assert_match(/^clean: destination$/, results)
+ assert_match(/^all: destination$/, results)
+ assert_match(/^install: destination$/, results)
end
end
@@ -77,9 +77,9 @@ install:
results = results.join("\n").b
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} clean$}, results
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']}$}, results
- assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']} clean$/, results)
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']}$/, results)
+ assert_match(/DESTDIR\\=#{ENV['DESTDIR']} install$/, results)
end
def test_custom_make_with_options
@@ -99,9 +99,9 @@ install:
end
Gem::Ext::Builder.make @dest_path, results, @ext
results = results.join("\n").b
- assert_match %r{clean: OK}, results
- assert_match %r{all: OK}, results
- assert_match %r{install: OK}, results
+ assert_match(/clean: OK/, results)
+ assert_match(/all: OK/, results)
+ assert_match(/install: OK/, results)
end
def test_build_extensions
@@ -251,7 +251,7 @@ install:
cmd_make_out = File.read(gem_make_out)
assert_match %r{#{Regexp.escape Gem.ruby} .* extconf\.rb}, cmd_make_out
- assert_match %r{: No such file}, cmd_make_out
+ assert_match(/: No such file/, cmd_make_out)
assert_path_not_exist @spec.gem_build_complete_path
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
index 5514112e64..5f886af05f 100644
--- a/test/rubygems/test_gem_ext_cmake_builder.rb
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -43,11 +43,11 @@ install (FILES test.txt DESTINATION bin)
output = output.join "\n"
- assert_match %r{^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
- assert_match %r{#{Regexp.escape @ext}}, output
+ assert_match(/^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}/, output)
+ assert_match(/#{Regexp.escape @ext}/, output)
assert_contains_make_command "", output
assert_contains_make_command "install", output
- assert_match %r{test\.txt}, output
+ assert_match(/test\.txt/, output)
end
def test_self_build_fail
@@ -59,12 +59,12 @@ install (FILES test.txt DESTINATION bin)
output = output.join "\n"
- shell_error_msg = %r{(CMake Error: .*)}
+ shell_error_msg = /(CMake Error: .*)/
assert_match "cmake failed", error.message
- assert_match %r{^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
- assert_match %r{#{shell_error_msg}}, output
+ assert_match(/^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}/, output)
+ assert_match(/#{shell_error_msg}/, output)
end
def test_self_build_has_makefile
diff --git a/test/rubygems/test_gem_ext_configure_builder.rb b/test/rubygems/test_gem_ext_configure_builder.rb
index 737aea6a34..6a2f9883f0 100644
--- a/test/rubygems/test_gem_ext_configure_builder.rb
+++ b/test/rubygems/test_gem_ext_configure_builder.rb
@@ -57,7 +57,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
assert_match(/^current directory:/, output.shift)
assert_equal "#{sh_prefix_configure}#{@dest_path}", output.shift
- assert_match %r{#{shell_error_msg}}, output.shift
+ assert_match(/#{shell_error_msg}/, output.shift)
assert_equal true, output.empty?
end
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index c0b7647704..bd72c1aa08 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -23,9 +23,9 @@ class TestGemExtRakeBuilder < Gem::TestCase
output = output.join "\n"
- refute_match %r{^rake failed:}, output
- assert_match %r{^#{Regexp.escape Gem.ruby} mkrf_conf\.rb}, output
- assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}}, output
+ refute_match(/^rake failed:/, output)
+ assert_match(/^#{Regexp.escape Gem.ruby} mkrf_conf\.rb/, output)
+ assert_match(/^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}/, output)
end
end
@@ -42,9 +42,9 @@ class TestGemExtRakeBuilder < Gem::TestCase
output = output.join "\n"
- refute_match %r{^rake failed:}, output
- assert_match %r{^#{Regexp.escape Gem.ruby} mkrf_conf\.rb}, output
- assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}}, output
+ refute_match(/^rake failed:/, output)
+ assert_match(/^#{Regexp.escape Gem.ruby} mkrf_conf\.rb/, output)
+ assert_match(/^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}/, output)
end
end
@@ -72,7 +72,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
output = output.join "\n"
assert_match "OpenSSL", output
- assert_match %r{^#{Regexp.escape Gem.ruby} mkrf_conf\.rb}, output
+ assert_match(/^#{Regexp.escape Gem.ruby} mkrf_conf\.rb/, output)
end
def test_class_build_no_mkrf_passes_args
@@ -83,8 +83,8 @@ class TestGemExtRakeBuilder < Gem::TestCase
output = output.join "\n"
- refute_match %r{^rake failed:}, output
- assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path} test1 test2}, output
+ refute_match(/^rake failed:/, output)
+ assert_match(/^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path} test1 test2/, output)
end
end
@@ -97,7 +97,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [], nil, @ext
end
- assert_match %r{^rake failed}, error.message
+ assert_match(/^rake failed/, error.message)
end
end
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index f16e23f72a..3c021fed11 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -96,9 +96,9 @@ class TestGemGemcutterUtilities < Gem::TestCase
api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
util_sign_in HTTPResponseFactory.create(body: api_key, code: 200, msg: "OK")
- assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
+ assert_match(/Enter your RubyGems.org credentials./, @sign_in_ui.output)
assert @fetcher.last_request["authorization"]
- assert_match %r{Signed in.}, @sign_in_ui.output
+ assert_match(/Signed in./, @sign_in_ui.output)
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials[:rubygems_api_key]
@@ -112,7 +112,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match "Enter your http://example.com credentials.",
@sign_in_ui.output
assert @fetcher.last_request["authorization"]
- assert_match %r{Signed in.}, @sign_in_ui.output
+ assert_match(/Signed in./, @sign_in_ui.output)
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials["http://example.com"]
@@ -126,7 +126,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match "Enter your RubyGems.org credentials.",
@sign_in_ui.output
assert @fetcher.last_request["authorization"]
- assert_match %r{Signed in.}, @sign_in_ui.output
+ assert_match(/Signed in./, @sign_in_ui.output)
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials[:rubygems_api_key]
@@ -139,7 +139,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match "Enter your http://example.com credentials.",
@sign_in_ui.output
assert @fetcher.last_request["authorization"]
- assert_match %r{Signed in.}, @sign_in_ui.output
+ assert_match(/Signed in./, @sign_in_ui.output)
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials["http://example.com"]
@@ -172,8 +172,8 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
util_sign_in HTTPResponseFactory.create(body: api_key, code: 200, msg: "OK")
- assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
- assert_match %r{Signed in.}, @sign_in_ui.output
+ assert_match(/Enter your RubyGems.org credentials./, @sign_in_ui.output)
+ assert_match(/Signed in./, @sign_in_ui.output)
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials[:rubygems_api_key]
@@ -185,8 +185,8 @@ class TestGemGemcutterUtilities < Gem::TestCase
util_sign_in HTTPResponseFactory.create(body: "Access Denied.", code: 403, msg: "Forbidden")
end
- assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
- assert_match %r{Access Denied.}, @sign_in_ui.output
+ assert_match(/Enter your RubyGems.org credentials./, @sign_in_ui.output)
+ assert_match(/Access Denied./, @sign_in_ui.output)
end
def test_signin_with_env_otp_code
diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb
index 676caee9c1..56bf3d9264 100644
--- a/test/rubygems/test_gem_indexer.rb
+++ b/test/rubygems/test_gem_indexer.rb
@@ -49,7 +49,7 @@ class TestGemIndexer < Gem::TestCase
def test_initialize
assert_equal @indexerdir, @indexer.dest_directory
Dir.mktmpdir("gem_generate_index") do |tmpdir|
- assert_match %r{#{tmpdir.match(/.*-/)}}, @indexer.directory
+ assert_match(%r{#{tmpdir.match(/.*-/)}}, @indexer.directory) # rubocop:disable Style/RegexpLiteral
end
with_indexer(@indexerdir) do |indexer|
@@ -206,15 +206,14 @@ class TestGemIndexer < Gem::TestCase
@indexer.generate_index
end
- assert_match %r{^\.\.\.\.\.\.\.\.\.\.\.\.$}, @ui.output
- assert_match %r{^Generating Marshal quick index gemspecs for 12 gems$},
- @ui.output
- assert_match %r{^Complete$}, @ui.output
- assert_match %r{^Generating specs index$}, @ui.output
- assert_match %r{^Generating latest specs index$}, @ui.output
- assert_match %r{^Generating prerelease specs index$}, @ui.output
- assert_match %r{^Complete$}, @ui.output
- assert_match %r{^Compressing indices$}, @ui.output
+ assert_match(/^\.\.\.\.\.\.\.\.\.\.\.\.$/, @ui.output)
+ assert_match(/^Generating Marshal quick index gemspecs for 12 gems$/, @ui.output)
+ assert_match(/^Complete$/, @ui.output)
+ assert_match(/^Generating specs index$/, @ui.output)
+ assert_match(/^Generating latest specs index$/, @ui.output)
+ assert_match(/^Generating prerelease specs index$/, @ui.output)
+ assert_match(/^Complete$/, @ui.output)
+ assert_match(/^Compressing indices$/, @ui.output)
assert_equal "", @ui.error
end
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 8fdadbb2f7..4ebbdfbab2 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -84,7 +84,7 @@ end
assert_path_exist installed_exec
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_check_executable_overwrite_default_bin_dir
@@ -100,8 +100,8 @@ end
end
conflicted = File.join @gemhome, "bin", "executable"
- assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
- e.message
+ assert_match(/\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z/,
+ e.message)
end
end
end
@@ -142,7 +142,7 @@ gem 'other', version
assert_path_exist installed_exec
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
ensure
Gem::Installer.exec_format = nil
end
@@ -177,7 +177,7 @@ gem 'other', version
assert_path_exist installed_exec
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_check_executable_overwrite_other_non_gem
@@ -192,7 +192,7 @@ gem 'other', version
assert_path_exist installed_exec
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end unless Gem.win_platform?
def test_check_that_user_bin_dir_is_in_path
@@ -338,7 +338,7 @@ gem 'other', version
assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform?
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_generate_bin_bindir_with_user_install_warning
@@ -383,7 +383,7 @@ gem 'other', version
assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform?
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_generate_bin_script_format
@@ -442,7 +442,7 @@ gem 'other', version
assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform?
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_generate_bin_script_no_execs
@@ -499,7 +499,7 @@ gem 'other', version
assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform?
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
# HACK: some gems don't have #! in their executables, restore 2008/06
# assert_no_match %r|generated by RubyGems|, wrapper
end
@@ -525,10 +525,10 @@ gem 'other', version
assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform?
- assert_match %r{generated by RubyGems}, File.read(installed_exec)
+ assert_match(/generated by RubyGems/, File.read(installed_exec))
- refute_match %r{generated by RubyGems}, File.read(real_exec),
- "real executable overwritten"
+ refute_match(/generated by RubyGems/, File.read(real_exec),
+ "real executable overwritten")
end
def test_generate_bin_symlink
@@ -1338,7 +1338,7 @@ gem 'other', version
installer.install
end
- assert_match %r{I am a shiny gem!}, @ui.output
+ assert_match(/I am a shiny gem!/, @ui.output)
end
def test_install_with_skipped_message
@@ -1352,7 +1352,7 @@ gem 'other', version
installer.install
end
- refute_match %r{I am a shiny gem!}, @ui.output
+ refute_match(/I am a shiny gem!/, @ui.output)
end
def test_install_extension_dir
@@ -2342,10 +2342,10 @@ gem 'other', version
wrapper = File.read installed_exec
if symlink_supported?
- refute_match %r{generated by RubyGems}, wrapper
+ refute_match(/generated by RubyGems/, wrapper)
else # when symlink not supported, it warns and fallbacks back to installing wrapper
- assert_match %r{Unable to use symlinks, installing wrapper}, @ui.error
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/Unable to use symlinks, installing wrapper/, @ui.error)
+ assert_match(/generated by RubyGems/, wrapper)
end
end
@@ -2366,7 +2366,7 @@ gem 'other', version
assert_path_exist installed_exec
wrapper = File.read installed_exec
- assert_match %r{generated by RubyGems}, wrapper
+ assert_match(/generated by RubyGems/, wrapper)
end
def test_default_gem_with_exe_as_bindir
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index cb1f9d4556..a7fb60dd12 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -965,8 +965,8 @@ class TestGemPackage < Gem::Package::TarTestCase
package.verify
end
- assert_match %r{^No such file or directory}, e.message
- assert_match %r{nonexistent.gem$}, e.message
+ assert_match(/^No such file or directory/, e.message)
+ assert_match(/nonexistent.gem$/, e.message)
end
def test_verify_duplicate_file
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index fa2d9e107d..31e5a6701d 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -538,8 +538,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
fetcher.fetch_path url
end
- assert_match %r{ECONNREFUSED:.*connect\(2\) \(#{Regexp.escape url}\)\z},
- e.message
+ assert_match(/ECONNREFUSED:.*connect\(2\) \(#{Regexp.escape url}\)\z/,
+ e.message)
assert_equal url, e.uri
end
@@ -557,8 +557,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
fetcher.fetch_path url
end
- assert_match %r{Timeout::Error: timed out \(#{Regexp.escape url}\)\z},
- e.message
+ assert_match(/Timeout::Error: timed out \(#{Regexp.escape url}\)\z/,
+ e.message)
assert_equal url, e.uri
end
@@ -576,8 +576,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
fetcher.fetch_path url
end
- assert_match %r{SocketError: getaddrinfo: nodename nor servname provided \(#{Regexp.escape url}\)\z},
- e.message
+ assert_match(/SocketError: getaddrinfo: nodename nor servname provided \(#{Regexp.escape url}\)\z/,
+ e.message)
assert_equal url, e.uri
end
diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb
index 26b7ab66fb..e260cfda90 100644
--- a/test/rubygems/test_gem_request.rb
+++ b/test/rubygems/test_gem_request.rb
@@ -281,7 +281,7 @@ class TestGemRequest < Gem::TestCase
assert_match %r{RubyGems/#{Regexp.escape Gem::VERSION}}, ua
assert_match %r{ #{Regexp.escape Gem::Platform.local.to_s} }, ua
assert_match %r{Ruby/#{Regexp.escape RUBY_VERSION}}, ua
- assert_match %r{\(#{Regexp.escape RUBY_RELEASE_DATE} }, ua
+ assert_match(/\(#{Regexp.escape RUBY_RELEASE_DATE} /, ua)
end
def test_user_agent_engine
@@ -292,7 +292,7 @@ class TestGemRequest < Gem::TestCase
ua = make_request(@uri, nil, nil, nil).user_agent
- assert_match %r{\) vroom}, ua
+ assert_match(/\) vroom/, ua)
ensure
util_restore_version
end
@@ -305,7 +305,7 @@ class TestGemRequest < Gem::TestCase
ua = make_request(@uri, nil, nil, nil).user_agent
- assert_match %r{\)}, ua
+ assert_match(/\)/, ua)
ensure
util_restore_version
end
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 74685606c0..64d3d6123e 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1840,7 +1840,7 @@ dependencies: []
end
def test_full_gem_path_double_slash
- gemhome = @gemhome.to_s.sub(/\w\//, '\&/')
+ gemhome = @gemhome.to_s.sub(%r{\w/}, '\&/')
@a1.loaded_from = File.join gemhome, "specifications", @a1.spec_name
expected = File.join @gemhome, "gems", @a1.full_name
@@ -2445,7 +2445,7 @@ end
ruby = @a2.to_ruby
- assert_match %r%^ s\.metadata = \{ "%, ruby
+ assert_match(/^ s\.metadata = \{ "/, ruby)
end
def test_to_ruby_platform
@@ -2462,7 +2462,7 @@ end
def test_to_yaml
yaml_str = @a1.to_yaml
- refute_match %r{!!null}, yaml_str
+ refute_match(/!!null/, yaml_str)
same_spec = Gem::Specification.from_yaml(yaml_str)
@@ -2483,7 +2483,7 @@ end
def test_to_yaml_platform_empty_string
@a1.instance_variable_set :@original_platform, ""
- assert_match %r{^platform: ruby$}, @a1.to_yaml
+ assert_match(/^platform: ruby$/, @a1.to_yaml)
end
def test_to_yaml_platform_legacy
@@ -2501,7 +2501,7 @@ end
def test_to_yaml_platform_nil
@a1.instance_variable_set :@original_platform, nil
- assert_match %r{^platform: ruby$}, @a1.to_yaml
+ assert_match(/^platform: ruby$/, @a1.to_yaml)
end
def test_validate
@@ -3306,7 +3306,7 @@ Did you mean 'Ruby'?
spec.validate
end
- assert_match %r{^#{name}}, e.message
+ assert_match(/^#{name}/, e.message)
end
end
end
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index 212cf8c9a0..dd296b0807 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -467,12 +467,12 @@ create_makefile '#{@spec.name}'
lines = ui.output.split("\n")
lines.shift
- assert_match %r{You have requested to uninstall the gem:}, lines.shift
+ assert_match(/You have requested to uninstall the gem:/, lines.shift)
lines.shift
lines.shift
- assert_match %r{r-1 depends on q \(= 1\)}, lines.shift
- assert_match %r{Successfully uninstalled q-1}, lines.last
+ assert_match(/r-1 depends on q \(= 1\)/, lines.shift)
+ assert_match(/Successfully uninstalled q-1/, lines.last)
end
def test_uninstall_only_lists_unsatisfied_deps
@@ -497,12 +497,12 @@ create_makefile '#{@spec.name}'
lines = ui.output.split("\n")
lines.shift
- assert_match %r{You have requested to uninstall the gem:}, lines.shift
+ assert_match(/You have requested to uninstall the gem:/, lines.shift)
lines.shift
lines.shift
- assert_match %r{x-1 depends on q \(= 1.0\)}, lines.shift
- assert_match %r{Successfully uninstalled q-1.0}, lines.last
+ assert_match(/x-1 depends on q \(= 1.0\)/, lines.shift)
+ assert_match(/Successfully uninstalled q-1.0/, lines.last)
end
def test_uninstall_doesnt_prompt_when_other_gem_satisfies_requirement
@@ -578,12 +578,12 @@ create_makefile '#{@spec.name}'
lines = ui.output.split("\n")
lines.shift
- assert_match %r{You have requested to uninstall the gem:}, lines.shift
+ assert_match(/You have requested to uninstall the gem:/, lines.shift)
lines.shift
lines.shift
- assert_match %r{r-1 depends on q \(= 1, development\)}, lines.shift
- assert_match %r{Successfully uninstalled q-1}, lines.last
+ assert_match(/r-1 depends on q \(= 1, development\)/, lines.shift)
+ assert_match(/Successfully uninstalled q-1/, lines.last)
end
def test_uninstall_prompt_only_lists_the_dependents_that_prevented_uninstallation
@@ -607,12 +607,12 @@ create_makefile '#{@spec.name}'
lines = ui.output.split("\n")
lines.shift
- assert_match %r{You have requested to uninstall the gem:}, lines.shift
+ assert_match(/You have requested to uninstall the gem:/, lines.shift)
lines.shift
lines.shift
- assert_match %r{s-1 depends on q \(= 1\)}, lines.shift
- assert_match %r{Successfully uninstalled q-1}, lines.last
+ assert_match(/s-1 depends on q \(= 1\)/, lines.shift)
+ assert_match(/Successfully uninstalled q-1/, lines.last)
end
def test_uninstall_no_permission
diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb
index 7efb98cecb..5d9028ede7 100644
--- a/test/rubygems/test_remote_fetch_error.rb
+++ b/test/rubygems/test_remote_fetch_error.rb
@@ -5,7 +5,7 @@ require_relative "helper"
class TestGemRemoteFetchError < Gem::TestCase
def test_password_redacted
error = Gem::RemoteFetcher::FetchError.new("There was an error fetching", "https://user:secret@gemsource.org")
- refute_match %r{secret}, error.to_s
+ refute_match(/secret/, error.to_s)
end
def test_invalid_url