From ab0580fd65c63a6e1f3f48d8654e33aeda64699d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 24 Mar 2020 19:51:43 +0100 Subject: [PATCH] Enable Style/PercentLiteralDelimiters cop in rubygems So it matches the style used by bundler. --- .rubocop.yml | 3 + Rakefile | 6 +- lib/rubygems.rb | 2 +- lib/rubygems/commands/setup_command.rb | 2 +- lib/rubygems/ext/ext_conf_builder.rb | 2 +- lib/rubygems/safe_yaml.rb | 8 +- lib/rubygems/server.rb | 2 +- lib/rubygems/source/git.rb | 4 +- lib/rubygems/specification.rb | 2 +- lib/rubygems/test_case.rb | 4 +- lib/rubygems/test_utilities.rb | 4 +- lib/rubygems/util/licenses.rb | 8 +- test/rubygems/test_gem.rb | 40 ++++---- test/rubygems/test_gem_command.rb | 4 +- .../test_gem_commands_cleanup_command.rb | 2 +- .../test_gem_commands_contents_command.rb | 28 +++--- .../test_gem_commands_environment_command.rb | 42 ++++---- .../test_gem_commands_info_command.rb | 12 +-- .../test_gem_commands_install_command.rb | 6 +- test/rubygems/test_gem_commands_mirror.rb | 2 +- .../test_gem_commands_open_command.rb | 6 +- .../test_gem_commands_owner_command.rb | 6 +- .../test_gem_commands_pristine_command.rb | 8 +- .../test_gem_commands_push_command.rb | 4 +- .../test_gem_commands_query_command.rb | 8 +- .../test_gem_commands_setup_command.rb | 8 +- ...test_gem_commands_specification_command.rb | 36 +++---- .../test_gem_commands_uninstall_command.rb | 2 +- .../test_gem_commands_which_command.rb | 6 +- .../test_gem_commands_yank_command.rb | 12 +-- .../rubygems/test_gem_dependency_installer.rb | 4 +- .../test_gem_dependency_resolution_error.rb | 2 +- test/rubygems/test_gem_ext_builder.rb | 24 ++--- test/rubygems/test_gem_ext_cmake_builder.rb | 10 +- .../test_gem_ext_configure_builder.rb | 2 +- test/rubygems/test_gem_ext_rake_builder.rb | 18 ++-- test/rubygems/test_gem_indexer.rb | 16 ++-- test/rubygems/test_gem_installer.rb | 36 +++---- test/rubygems/test_gem_package.rb | 4 +- test/rubygems/test_gem_remote_fetcher.rb | 2 +- test/rubygems/test_gem_request.rb | 22 ++--- test/rubygems/test_gem_request_set.rb | 4 +- ...test_gem_request_set_gem_dependency_api.rb | 2 +- test/rubygems/test_gem_resolver.rb | 2 +- test/rubygems/test_gem_security_signer.rb | 2 +- test/rubygems/test_gem_server.rb | 20 ++-- test/rubygems/test_gem_specification.rb | 96 +++++++++---------- test/rubygems/test_gem_uninstaller.rb | 26 ++--- test/rubygems/test_require.rb | 44 ++++----- 49 files changed, 309 insertions(+), 306 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1087db19c68b..f963a7d5e1c4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -89,3 +89,6 @@ Style/MutableConstant: Style/BlockDelimiters: Enabled: true + +Style/PercentLiteralDelimiters: + Enabled: true diff --git a/Rakefile b/Rakefile index 57282267a26c..49515ba497e3 100644 --- a/Rakefile +++ b/Rakefile @@ -76,7 +76,7 @@ namespace :rubocop do end end -task rubocop: %w(rubocop:rubygems rubocop:bundler) +task rubocop: %w[rubocop:rubygems rubocop:bundler] desc "Run a test suite bisection" task(:bisect) do @@ -275,7 +275,7 @@ namespace 'blog' do history.force_encoding Encoding::UTF_8 - _, change_log, = history.split %r%^===\s*\d.*%, 3 + _, change_log, = history.split %r{^===\s*\d.*}, 3 change_types = [] @@ -386,7 +386,7 @@ module Rubygems def self.all files = [] - exclude = %r[\.git|\./bundler/(?!lib|man|exe|[^/]+\.md|bundler.gemspec)]ox + exclude = %r{\.git|\./bundler/(?!lib|man|exe|[^/]+\.md|bundler.gemspec)}ox tracked_files = `git ls-files`.split("\n").map {|f| "./#{f}" } tracked_files.each do |path| diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 20d46f6094f8..391c72c8248b 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -1011,7 +1011,7 @@ def self.plugin_suffix_regexp def self.suffixes @suffixes ||= ['', '.rb', - *%w(DLEXT DLEXT2).map do |key| + *%w[DLEXT DLEXT2].map do |key| val = RbConfig::CONFIG[key] next unless val and not val.empty? ".#{val}" diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index d67caca91cde..679803c33845 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -546,7 +546,7 @@ def remove_old_bin_files(bin_dir) next unless Gem.win_platform? File.open "#{old_bin_path}.bat", 'w' do |fp| - fp.puts %{@ECHO.#{deprecation_message}} + fp.puts %(@ECHO.#{deprecation_message}) end end end diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 88be7ecfe8ec..d06e923a30a9 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -27,7 +27,7 @@ def self.build(extension, dest_path, results, args=[], lib_dir=nil) # Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940 tmp_dest = get_relative_path(tmp_dest) - Tempfile.open %w"siteconf .rb", "." do |siteconf| + Tempfile.open %w[siteconf .rb], "." do |siteconf| siteconf.puts "require 'rbconfig'" siteconf.puts "dest_path = #{tmp_dest.dump}" %w[sitearchdir sitelibdir].each do |dir| diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb index 3540fd74ddee..29312ad5a134 100644 --- a/lib/rubygems/safe_yaml.rb +++ b/lib/rubygems/safe_yaml.rb @@ -7,7 +7,7 @@ module Gem # Psych.safe_load module SafeYAML - PERMITTED_CLASSES = %w( + PERMITTED_CLASSES = %w[ Symbol Time Date @@ -19,12 +19,12 @@ module SafeYAML Gem::Version::Requirement YAML::Syck::DefaultKey Syck::DefaultKey - ).freeze + ].freeze - PERMITTED_SYMBOLS = %w( + PERMITTED_SYMBOLS = %w[ development runtime - ).freeze + ].freeze if ::YAML.respond_to? :safe_load def self.safe_load(input) diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb index 83d7cf5abc86..b2130852e068 100644 --- a/lib/rubygems/server.rb +++ b/lib/rubygems/server.rb @@ -573,7 +573,7 @@ def quick(req, res) add_date res case req.request_uri.path - when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)\.gemspec\.rz$| then + when %r{^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)\.gemspec\.rz$} then marshal_format, full_name = $1, $2 specs = Gem::Specification.find_all_by_full_name(full_name) diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index 0b8a4339cc79..ec2c371fa9da 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -228,8 +228,8 @@ def uri_hash # :nodoc: require 'digest' # required here to avoid deadlocking in Gem.activate_bin_path (because digest is a gem on 2.5+) normalized = - if @repository =~ %r%^\w+://(\w+@)?% - uri = URI(@repository).normalize.to_s.sub %r%/$%,'' + if @repository =~ %r{^\w+://(\w+@)?} + uri = URI(@repository).normalize.to_s.sub %r{/$},'' uri.sub(/\A(\w+)/) { $1.downcase } else @repository diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index d9f93a2a3377..f4722fd7a863 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -2188,7 +2188,7 @@ def pretty_print(q) # :nodoc: attributes.each do |attr_name| current_value = self.send attr_name - current_value = current_value.sort if %i(files test_files).include? attr_name + current_value = current_value.sort if %i[files test_files].include? attr_name if current_value != default_value(attr_name) or self.class.required_attribute? attr_name diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index ebfe979a1b9e..27b70222c9c7 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -576,7 +576,7 @@ def have_git? end def in_path?(executable) # :nodoc: - return true if %r%\A([A-Z]:|/)% =~ executable and File.exist? executable + return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory| File.exist? File.join directory, executable @@ -1286,7 +1286,7 @@ class << self def escape_path(*path) path = File.join(*path) - if %r'\A[-+:/=@,.\w]+\z' =~ path + if %r{\A[-+:/=@,.\w]+\z} =~ path path else "\"#{path.gsub(/[`$"]/, '\\&')}\"" diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb index 69ff05370ecf..6ae3c0e986e7 100644 --- a/lib/rubygems/test_utilities.rb +++ b/lib/rubygems/test_utilities.rb @@ -49,7 +49,7 @@ def find_data(path, nargs = 3) path = path.to_s @paths << path - raise ArgumentError, 'need full URI' unless path =~ %r'^https?://' + raise ArgumentError, 'need full URI' unless path =~ %r{^https?://} unless @data.key? path raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) @@ -121,7 +121,7 @@ def fetch_size(path) path = path.to_s @paths << path - raise ArgumentError, 'need full URI' unless path =~ %r'^http://' + raise ArgumentError, 'need full URI' unless path =~ %r{^http://} unless @data.key? path raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb index f23be157b922..5b8266778532 100644 --- a/lib/rubygems/util/licenses.rb +++ b/lib/rubygems/util/licenses.rb @@ -9,7 +9,7 @@ class Gem::Licenses # Software Package Data Exchange (SPDX) standard open-source software # license identifiers - LICENSE_IDENTIFIERS = %w( + LICENSE_IDENTIFIERS = %w[ 0BSD AAL ADSL @@ -379,10 +379,10 @@ class Gem::Licenses xinetd xpp zlib-acknowledgement - ).freeze + ].freeze # exception identifiers - EXCEPTION_IDENTIFIERS = %w( + EXCEPTION_IDENTIFIERS = %w[ 389-exception Autoconf-exception-2.0 Autoconf-exception-3.0 @@ -410,7 +410,7 @@ class Gem::Licenses mif-exception openvpn-openssl-exception u-boot-exception-2.0 - ).freeze + ].freeze REGEXP = %r{ \A diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index bea88b78436e..645f10b4ff22 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -42,12 +42,12 @@ def test_self_finish_resolve a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names Gem.finish_resolve - assert_equal %w(a-1 b-2 c-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2], loaded_spec_names assert_equal [], unresolved_names end end @@ -66,12 +66,12 @@ def test_self_finish_resolve_wtf a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)", "d (> 0)"], unresolved_names Gem.finish_resolve - assert_equal %w(a-1 b-1 c-1 d-2), loaded_spec_names + assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names assert_equal [], unresolved_names end end @@ -89,12 +89,12 @@ def test_self_finish_resolve_respects_loaded_specs a1.activate c1.activate - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names Gem.finish_resolve - assert_equal %w(a-1 b-1 c-1), loaded_spec_names + assert_equal %w[a-1 b-1 c-1], loaded_spec_names assert_equal [], unresolved_names end end @@ -299,7 +299,7 @@ def test_activate_bin_path_resolves_eagerly gem 'c' Gem.finish_resolve - assert_equal %w(a-1 b-2 c-1), loaded_spec_names + assert_equal %w[a-1 b-2 c-1], loaded_spec_names end def test_activate_bin_path_in_debug_mode @@ -383,7 +383,7 @@ def test_activate_bin_path_selects_exact_bundler_version_if_present load Gem.activate_bin_path("bundler", "bundle", ">= 0.a") - assert_equal %w(bundler-2.0.0), loaded_spec_names + assert_equal %w[bundler-2.0.0], loaded_spec_names end def test_activate_bin_path_respects_underscore_selection_if_given @@ -417,7 +417,7 @@ def test_activate_bin_path_respects_underscore_selection_if_given load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3") - assert_equal %w(bundler-1.17.3), loaded_spec_names + assert_equal %w[bundler-1.17.3], loaded_spec_names end def test_self_bin_path_no_exec_name @@ -716,7 +716,7 @@ def test_self_find_files discover_path = File.join 'lib', 'sff', 'discover.rb' - foo1, foo2 = %w(1 2).map do |version| + foo1, foo2 = %w[1 2].map do |version| spec = quick_gem 'sff', version do |s| s.files << discover_path end @@ -748,7 +748,7 @@ def test_self_find_files_with_gemfile discover_path = File.join 'lib', 'sff', 'discover.rb' - foo1, _ = %w(1 2).map do |version| + foo1, _ = %w[1 2].map do |version| spec = quick_gem 'sff', version do |s| s.files << discover_path end @@ -784,7 +784,7 @@ def test_self_find_latest_files discover_path = File.join 'lib', 'sff', 'discover.rb' - _, foo2 = %w(1 2).map do |version| + _, foo2 = %w[1 2].map do |version| spec = quick_gem 'sff', version do |s| s.files << discover_path end @@ -1274,7 +1274,7 @@ def test_self_try_activate_missing_dep Gem.try_activate 'a_file' end - assert_match %r%Could not find 'b' %, e.message + assert_match %r{Could not find 'b' }, e.message end def test_self_try_activate_missing_prerelease @@ -1294,7 +1294,7 @@ def test_self_try_activate_missing_prerelease Gem.try_activate 'a_file' end - assert_match %r%Could not find 'b' \(= 1.0rc1\)%, e.message + assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message end def test_self_try_activate_missing_extensions @@ -1399,7 +1399,7 @@ def test_self_needs activated = Gem::Specification.map { |x| x.full_name } - assert_equal %w!a-1 b-1 c-2!, activated.sort + assert_equal %w[a-1 b-1 c-2], activated.sort end def test_self_needs_picks_up_unresolved_deps @@ -1419,7 +1419,7 @@ def test_self_needs_picks_up_unresolved_deps require "d#{$$}" end - assert_equal %w!a-1 b-1 c-2 d-1 e-1!, loaded_spec_names + assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names end end @@ -1611,7 +1611,7 @@ def test_auto_activation_of_specific_gemdeps_file Gem.use_gemdeps - assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names + assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names end def test_auto_activation_of_used_gemdeps_file @@ -1765,7 +1765,7 @@ def test_use_gemdeps Gem.use_gemdeps gem_deps_file - assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names + assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names refute_nil Gem.gemdeps end @@ -1825,7 +1825,7 @@ def test_use_gemdeps_automatic Gem.use_gemdeps - assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names + assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names ensure ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps end @@ -1902,7 +1902,7 @@ def test_use_gemdeps_specific Gem.use_gemdeps - assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names + assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names ensure ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps end diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index c62a68ecfd42..44ec324ab9d6 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -103,7 +103,7 @@ def test_defaults @cmd.invoke end - assert_match %r|Usage: gem doit|, @ui.output + assert_match %r{Usage: gem doit}, @ui.output end def test_invoke @@ -189,7 +189,7 @@ def test_invoke_with_options @cmd.invoke '-h' end - assert_match %r|Usage: gem doit|, @ui.output + assert_match %r{Usage: gem doit}, @ui.output end def test_option_recognition diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb index 3494085a6454..2f1591674cb9 100644 --- a/test/rubygems/test_gem_commands_cleanup_command.rb +++ b/test/rubygems/test_gem_commands_cleanup_command.rb @@ -220,7 +220,7 @@ def test_execute_ignore_default_gem_verbose @cmd.execute end - assert_match %r%^Skipped default gems: b-2%, @ui.output + assert_match %r{^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 93ebcca5bb3d..d8f01ecbf0b6 100644 --- a/test/rubygems/test_gem_commands_contents_command.rb +++ b/test/rubygems/test_gem_commands_contents_command.rb @@ -27,8 +27,8 @@ def test_execute @cmd.execute end - assert_match %r|lib/foo\.rb|, @ui.output - assert_match %r|Rakefile|, @ui.output + assert_match %r{lib/foo\.rb}, @ui.output + assert_match %r{Rakefile}, @ui.output assert_equal "", @ui.error end @@ -42,9 +42,9 @@ def test_execute_all @cmd.execute end - assert_match %r|lib/foo\.rb|, @ui.output - assert_match %r|lib/bar\.rb|, @ui.output - assert_match %r|Rakefile|, @ui.output + assert_match %r{lib/foo\.rb}, @ui.output + assert_match %r{lib/bar\.rb}, @ui.output + assert_match %r{Rakefile}, @ui.output assert_equal "", @ui.error end @@ -57,8 +57,8 @@ def test_execute_bad_gem 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 %r{Unable to find gem 'foo' in default gem paths}, @ui.output + assert_match %r{Directories searched:}, @ui.output assert_equal "", @ui.error end @@ -71,8 +71,8 @@ def test_execute_exact_match @cmd.execute end - assert_match %r|lib/foo\.rb|, @ui.output - assert_match %r|Rakefile|, @ui.output + assert_match %r{lib/foo\.rb}, @ui.output + assert_match %r{Rakefile}, @ui.output assert_equal "", @ui.error end @@ -86,8 +86,8 @@ def test_execute_lib_only @cmd.execute end - assert_match %r|lib/foo\.rb|, @ui.output - refute_match %r|Rakefile|, @ui.output + assert_match %r{lib/foo\.rb}, @ui.output + refute_match %r{Rakefile}, @ui.output assert_equal "", @ui.error end @@ -146,9 +146,9 @@ def test_execute_multiple @cmd.execute end - assert_match %r|lib/foo\.rb|, @ui.output - assert_match %r|lib/bar\.rb|, @ui.output - assert_match %r|Rakefile|, @ui.output + assert_match %r{lib/foo\.rb}, @ui.output + assert_match %r{lib/bar\.rb}, @ui.output + assert_match %r{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 5dd0fc7521b4..12ec8dd6b2fa 100644 --- a/test/rubygems/test_gem_commands_environment_command.rb +++ b/test/rubygems/test_gem_commands_environment_command.rb @@ -22,29 +22,29 @@ def test_execute @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}|, + 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|RUBYGEMS PREFIX: |, @ui.output - assert_match %r|RUBY EXECUTABLE:.*#{RbConfig::CONFIG['ruby_install_name']}|, + 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 %r|- /usr/local/bin$|, @ui.output - assert_match %r|- /usr/bin$|, @ui.output - assert_match %r|- /bin$|, @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 %r{- /usr/local/bin$}, @ui.output + assert_match %r{- /usr/bin$}, @ui.output + assert_match %r{- /bin$}, @ui.output assert_empty @ui.error diff --git a/test/rubygems/test_gem_commands_info_command.rb b/test/rubygems/test_gem_commands_info_command.rb index 373fccceeee7..0b7458f7c595 100644 --- a/test/rubygems/test_gem_commands_info_command.rb +++ b/test/rubygems/test_gem_commands_info_command.rb @@ -33,12 +33,12 @@ def test_execute @cmd.execute 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 %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 "", @ui.error end diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index a233377c4a07..e86e9e24d548 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -337,7 +337,7 @@ def test_execute_bad_source errs = @ui.error.split("\n") assert_match(/ould not find a valid gem 'nonexistent'/, errs.shift) - assert_match(%r!Unable to download data from http://not-there.nothing!, errs.shift) + assert_match(%r{Unable to download data from http://not-there.nothing}, errs.shift) end def test_execute_nonexistent_hint_disabled @@ -582,7 +582,7 @@ def test_execute_saves_build_args fetcher.gem 'a', 2 end - args = %w!--with-awesome=true --more-awesome=yes! + args = %w[--with-awesome=true --more-awesome=yes] Gem::Command.build_args = args @@ -886,7 +886,7 @@ def test_parses_requirement_from_gemname end assert_equal 2, e.exit_code - assert_match %r!Could not find a valid gem 'a' \(= 10.0\)!, @ui.error + assert_match %r{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 07ec9f3d0c7d..9d3d7169f1d7 100644 --- a/test/rubygems/test_gem_commands_mirror.rb +++ b/test/rubygems/test_gem_commands_mirror.rb @@ -15,7 +15,7 @@ def test_execute @cmd.execute end - assert_match %r%Install the rubygems-mirror%i, @ui.error + assert_match %r{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 e73a1382048d..33836f7498d9 100644 --- a/test/rubygems/test_gem_commands_open_command.rb +++ b/test/rubygems/test_gem_commands_open_command.rb @@ -51,7 +51,7 @@ def test_wrong_version end end - assert_match %r|Unable to find gem 'foo'|, @ui.output + assert_match %r{Unable to find gem 'foo'}, @ui.output assert_equal "", @ui.error end @@ -64,7 +64,7 @@ def test_execute_bad_gem end end - assert_match %r|Unable to find gem 'foo'|, @ui.output + assert_match %r{Unable to find gem 'foo'}, @ui.output assert_equal "", @ui.error end @@ -93,7 +93,7 @@ def test_default_gem end end - assert_match %r|'foo' is a default gem and can't be opened\.| , @ui.output + assert_match %r{'foo' is a default gem and can't be opened\.} , @ui.output assert_equal "", @ui.error end diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index 799d631f8a91..35424629fec8 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -119,7 +119,7 @@ def test_show_owners_key end Gem.configuration.load_api_keys - @cmd.handle_options %w(-k other) + @cmd.handle_options %w[-k other] @cmd.show_owners('freewill') assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization'] @@ -177,7 +177,7 @@ def test_add_owners_key end Gem.configuration.load_api_keys - @cmd.handle_options %w(-k other) + @cmd.handle_options %w[-k other] @cmd.add_owners('freewill', ['user-new1@example.com']) assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization'] @@ -217,7 +217,7 @@ def test_remove_owners_key end Gem.configuration.load_api_keys - @cmd.handle_options %w(-k other) + @cmd.handle_options %w[-k other] @cmd.remove_owners('freewill', ['user-remove1@example.com']) assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization'] diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index 7f8837af1850..11344bb6b6e6 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -160,9 +160,9 @@ def test_execute_env_shebang ruby_exec = sprintf Gem.default_exec_format, 'ruby' - bin_env = win_platform? ? "" : %w(/usr/bin/env /bin/env).find {|f| File.executable?(f) } + " " + bin_env = 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 %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_exec) end def test_execute_extensions_explicit @@ -246,7 +246,7 @@ def test_execute_with_extension_with_build_args RUBY end - build_args = %w!--with-awesome=true --sweet! + build_args = %w[--with-awesome=true --sweet] install_gem a, :build_args => build_args @@ -455,7 +455,7 @@ def test_execute_no_gem end end - assert_match %r|at least one gem name|, e.message + assert_match %r{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 f666c6d4371d..ddb287388d57 100644 --- a/test/rubygems/test_gem_commands_push_command.rb +++ b/test/rubygems/test_gem_commands_push_command.rb @@ -246,7 +246,7 @@ def test_sending_gem_to_disallowed_default_host spec.metadata['allowed_push_host'] = "https://privategemserver.example" end - response = %{ERROR: "#{@host}" is not allowed by the gemspec, which only allows "https://privategemserver.example"} + response = %(ERROR: "#{@host}" is not allowed by the gemspec, which only allows "https://privategemserver.example") assert_raises Gem::MockGemUi::TermError do send_battery @@ -355,7 +355,7 @@ def test_sending_gem_key end Gem.configuration.load_api_keys - @cmd.handle_options %w(-k other) + @cmd.handle_options %w[-k other] @cmd.instance_variable_set :@host, @host @cmd.send_gem(@path) diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb index a25effb54825..23b9bf5f15db 100644 --- a/test/rubygems/test_gem_commands_query_command.rb +++ b/test/rubygems/test_gem_commands_query_command.rb @@ -580,8 +580,8 @@ def test_execute_multiple_args @cmd.execute end - assert_match %r%^a %, @stub_ui.output - assert_match %r%^pl %, @stub_ui.output + assert_match %r{^a }, @stub_ui.output + assert_match %r{^pl }, @stub_ui.output assert_equal '', @stub_ui.error end @@ -593,8 +593,8 @@ def test_show_gems @cmd.send :show_gems, /a/i end - assert_match %r%^a %, @stub_ui.output - refute_match %r%^pl %, @stub_ui.output + assert_match %r{^a }, @stub_ui.output + refute_match %r{^pl }, @stub_ui.output assert_empty @stub_ui.error end diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index f92b3dc73918..76792603d21d 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -196,10 +196,10 @@ def test_env_shebang_flag ruby_exec = sprintf Gem.default_exec_format, 'ruby' - bin_env = 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(gem_bin_path) + bin_env = 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(gem_bin_path) end def test_pem_files_in diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb index f56aa9777a98..cb66868568ba 100644 --- a/test/rubygems/test_gem_commands_specification_command.rb +++ b/test/rubygems/test_gem_commands_specification_command.rb @@ -21,8 +21,8 @@ def test_execute @cmd.execute end - assert_match %r|Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output assert_equal '', @ui.error end @@ -37,10 +37,10 @@ def test_execute_all @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 %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_equal '', @ui.error end @@ -99,8 +99,8 @@ def test_execute_exact_match @cmd.execute end - assert_match %r|Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output assert_equal '', @ui.error end @@ -131,8 +131,8 @@ def test_execute_file @cmd.execute end - assert_match %r|Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output assert_equal '', @ui.error end @@ -164,8 +164,8 @@ def test_execute_remote @cmd.execute end - assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output end def test_execute_remote_with_version @@ -200,8 +200,8 @@ def test_execute_remote_without_prerelease @cmd.execute end - assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output spec = YAML.load @ui.output @@ -222,8 +222,8 @@ def test_execute_remote_with_prerelease @cmd.execute end - assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output - assert_match %r|name: foo|, @ui.output + assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output + assert_match %r{name: foo}, @ui.output spec = YAML.load @ui.output @@ -242,8 +242,8 @@ def test_execute_ruby @cmd.execute end - assert_match %r|Gem::Specification.new|, @ui.output - assert_match %r|s.name = "foo"|, @ui.output + assert_match %r{Gem::Specification.new}, @ui.output + assert_match %r{s.name = "foo"}, @ui.output assert_equal '', @ui.error end diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb index 927a2412036d..1f71b4ce1d6a 100644 --- a/test/rubygems/test_gem_commands_uninstall_command.rb +++ b/test/rubygems/test_gem_commands_uninstall_command.rb @@ -486,7 +486,7 @@ def test_execute_with_gem_uninstall_error end assert_empty @ui.output - assert_match %r!Error: unable to successfully uninstall '#{@spec.name}'!, @ui.error + assert_match %r{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 0d63bb9b374f..3d66c0150cdc 100644 --- a/test/rubygems/test_gem_commands_which_command.rb +++ b/test/rubygems/test_gem_commands_which_command.rb @@ -33,7 +33,7 @@ def test_execute_directory end assert_equal '', @ui.output - assert_match %r%Can.t find Ruby library file or shared library directory\n%, + assert_match %r{Can.t find Ruby library file or shared library directory\n}, @ui.error end @@ -51,7 +51,7 @@ def test_execute_one_missing 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%, + assert_match %r{Can.t find Ruby library file or shared library missinglib\n}, @ui.error end @@ -65,7 +65,7 @@ def test_execute_missing end assert_equal '', @ui.output - assert_match %r%Can.t find Ruby library file or shared library missinglib\n%, + assert_match %r{Can.t find Ruby library file or shared library missinglib\n}, @ui.error end diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb index 1aafc92bfb8c..9f337ec67e4a 100644 --- a/test/rubygems/test_gem_commands_yank_command.rb +++ b/test/rubygems/test_gem_commands_yank_command.rb @@ -46,8 +46,8 @@ def test_execute @cmd.execute end - assert_match %r%Yanking gem from http://example%, @ui.output - assert_match %r%Successfully yanked%, @ui.output + assert_match %r{Yanking gem from http://example}, @ui.output + assert_match %r{Successfully yanked}, @ui.output platform = Gem.platforms[1] body = @fetcher.last_request.body.split('&').sort @@ -77,8 +77,8 @@ def test_execute_with_otp_success 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 %r{Yanking gem from http://example}, @otp_ui.output + assert_match %r{Successfully yanked}, @otp_ui.output assert_equal '111111', @fetcher.last_request['OTP'] end @@ -132,8 +132,8 @@ def test_execute_host @cmd.execute end - assert_match %r%Yanking gem from https://other.example%, @ui.output - assert_match %r%Successfully yanked%, @ui.output + assert_match %r{Yanking gem from https://other.example}, @ui.output + assert_match %r{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 048b9fed1d27..3e3a8677b1f1 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -559,7 +559,7 @@ def test_install_env_shebang env = "/\\S+/env" unless Gem.win_platform? - assert_match %r|\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n|, + assert_match %r{\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n}, File.read(File.join(@gemhome, 'bin', 'a_bin')) end @@ -875,7 +875,7 @@ def test_install_no_wrappers inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false inst.install 'a' - refute_match(%r|This file was generated by RubyGems.|, + refute_match(%r{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 cf4663650e0b..57e6191d87bb 100644 --- a/test/rubygems/test_gem_dependency_resolution_error.rb +++ b/test/rubygems/test_gem_dependency_resolution_error.rb @@ -21,7 +21,7 @@ def setup end def test_message - assert_match %r%^conflicting dependencies a \(= 1\) and a \(= 2\)$%, + assert_match %r{^conflicting dependencies a \(= 1\) and a \(= 2\)$}, @error.message end diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb index 7091acdca068..1a7587af7e0a 100644 --- a/test/rubygems/test_gem_ext_builder.rb +++ b/test/rubygems/test_gem_ext_builder.rb @@ -50,14 +50,14 @@ def test_class_make results = results.join "\n" - 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 %r{"DESTDIR=#{ENV['DESTDIR']}" clean$}, results + assert_match %r{"DESTDIR=#{ENV['DESTDIR']}"$}, results + assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" install$}, results if /nmake/ !~ results - assert_match %r%^clean: destination$%, results - assert_match %r%^all: destination$%, results - assert_match %r%^install: destination$%, results + assert_match %r{^clean: destination$}, results + assert_match %r{^all: destination$}, results + assert_match %r{^install: destination$}, results end end @@ -81,9 +81,9 @@ def test_class_make_no_clean results = results.join "\n" - 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 %r{"DESTDIR=#{ENV['DESTDIR']}" clean$}, results + assert_match %r{"DESTDIR=#{ENV['DESTDIR']}"$}, results + assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" install$}, results end def test_build_extensions @@ -234,9 +234,9 @@ def test_build_extensions_extconf_bad gem_make_out = File.join @spec.extension_dir, 'gem_make.out' - assert_match %r%#{Regexp.escape Gem.ruby}.* extconf\.rb%, + assert_match %r{#{Regexp.escape Gem.ruby}.* extconf\.rb}, File.read(gem_make_out) - assert_match %r%: No such file%, + assert_match %r{: No such file}, File.read(gem_make_out) refute_path_exists @spec.gem_build_complete_path @@ -244,7 +244,7 @@ def test_build_extensions_extconf_bad skip "Gem.ruby is not the name of the binary being run in the end" \ unless File.read(gem_make_out).include? "#{Gem.ruby}:" - assert_match %r%#{Regexp.escape Gem.ruby}: No such file%, + assert_match %r{#{Regexp.escape Gem.ruby}: No such file}, File.read(gem_make_out) assert_equal cwd, Dir.pwd diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb index 757266cae2bb..05673e1b6dce 100644 --- a/test/rubygems/test_gem_ext_cmake_builder.rb +++ b/test/rubygems/test_gem_ext_cmake_builder.rb @@ -41,11 +41,11 @@ def test_self_build output = output.join "\n" assert_match \ - %r%^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}%, output - assert_match %r%#{Regexp.escape @ext}%, output + %r{^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}}, output + assert_match %r{#{Regexp.escape @ext}}, output assert_contains_make_command '', output assert_contains_make_command 'install', output - assert_match %r%test\.txt%, output + assert_match %r{test\.txt}, output end def test_self_build_fail @@ -64,8 +64,8 @@ def test_self_build_fail assert_match 'cmake failed', error.message - assert_match %r%^#{sh_prefix_cmake}#{Regexp.escape @dest_path}%, output - assert_match %r%#{shell_error_msg}%, output + assert_match %r{^#{sh_prefix_cmake}#{Regexp.escape @dest_path}}, output + assert_match %r{#{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 967458170b32..ac8a861e1744 100644 --- a/test/rubygems/test_gem_ext_configure_builder.rb +++ b/test/rubygems/test_gem_ext_configure_builder.rb @@ -61,7 +61,7 @@ def test_self_build_fail 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 %r{#{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 c86ff0764900..1b5993c7055c 100644 --- a/test/rubygems/test_gem_ext_rake_builder.rb +++ b/test/rubygems/test_gem_ext_rake_builder.rb @@ -25,9 +25,9 @@ def test_class_build output = output.join "\n" - refute_match %r%^rake failed:%, output - assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output - assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}%, output + refute_match %r{^rake failed:}, output + assert_match %r{^#{Regexp.escape @@ruby} mkrf_conf\.rb}, output + assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}}, output end end @@ -46,9 +46,9 @@ def test_class_build_with_args output = output.join "\n" - refute_match %r%^rake failed:%, output - assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output - assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}%, output + refute_match %r{^rake failed:}, output + assert_match %r{^#{Regexp.escape @@ruby} mkrf_conf\.rb}, output + assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path}}, output end end @@ -62,8 +62,8 @@ def test_class_build_no_mkrf_passes_args 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 %r{^rake failed:}, output + assert_match %r{^#{Regexp.escape rake} RUBYARCHDIR\\=#{Regexp.escape @dest_path} RUBYLIBDIR\\=#{Regexp.escape @dest_path} test1 test2}, output end end @@ -78,7 +78,7 @@ def test_class_build_fail end end - assert_match %r%^rake failed%, error.message + assert_match %r{^rake failed}, error.message end end diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb index fdef33e46425..d5f28b8814c0 100644 --- a/test/rubygems/test_gem_indexer.rb +++ b/test/rubygems/test_gem_indexer.rb @@ -189,15 +189,15 @@ def test_generate_index_ui @indexer.generate_index end - assert_match %r%^\.\.\.\.\.\.\.\.\.\.\.\.$%, @ui.output - assert_match %r%^Generating Marshal quick index gemspecs for 12 gems$%, + 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 %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_equal '', @ui.error end diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index 4d0c4a1800b1..b1eb2ae670f9 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -98,7 +98,7 @@ def test_check_executable_overwrite assert_path_exists installed_exec wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end def test_check_executable_overwrite_default_bin_dir @@ -114,7 +114,7 @@ def test_check_executable_overwrite_default_bin_dir end conflicted = File.join @gemhome, 'bin', 'executable' - assert_match %r%\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z%, + assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z}, e.message end end @@ -156,7 +156,7 @@ def test_check_executable_overwrite_format_executable assert_path_exists installed_exec wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper ensure Gem::Installer.exec_format = nil end @@ -191,7 +191,7 @@ def test_check_executable_overwrite_other_gem_force assert_path_exists installed_exec wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end def test_check_executable_overwrite_other_non_gem @@ -206,7 +206,7 @@ def test_check_executable_overwrite_other_non_gem assert_path_exists installed_exec wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end unless Gem.win_platform? def test_check_that_user_bin_dir_is_in_path @@ -342,7 +342,7 @@ def test_generate_bin_bindir assert_equal mask, File.stat(installed_exec).mode unless win_platform? wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end def test_generate_bin_bindir_with_user_install_warning @@ -385,7 +385,7 @@ def test_generate_bin_script assert_equal mask, File.stat(installed_exec).mode unless win_platform? wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end def test_generate_bin_script_format @@ -444,7 +444,7 @@ def test_generate_bin_script_install_dir assert_equal mask, File.stat(installed_exec).mode unless win_platform? wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{generated by RubyGems}, wrapper end def test_generate_bin_script_no_execs @@ -501,7 +501,7 @@ def test_generate_bin_script_no_shebang assert_equal mask, File.stat(installed_exec).mode unless win_platform? wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{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 @@ -527,9 +527,9 @@ def test_generate_bin_script_wrappers assert_path_exists installed_exec assert_equal mask, File.stat(installed_exec).mode unless win_platform? - assert_match %r|generated by RubyGems|, File.read(installed_exec) + assert_match %r{generated by RubyGems}, File.read(installed_exec) - refute_match %r|generated by RubyGems|, File.read(real_exec), + refute_match %r{generated by RubyGems}, File.read(real_exec), 'real executable overwritten' end @@ -1251,7 +1251,7 @@ def test_install_with_message installer.install end - assert_match %r|I am a shiny gem!|, @ui.output + assert_match %r{I am a shiny gem!}, @ui.output end def test_install_with_skipped_message @@ -1265,7 +1265,7 @@ def test_install_with_skipped_message installer.install end - refute_match %r|I am a shiny gem!|, @ui.output + refute_match %r{I am a shiny gem!}, @ui.output end def test_install_extension_dir @@ -1469,7 +1469,7 @@ def test_install_extension_flat end # empty depend file for no auto dependencies - @spec.files += %W"depend #{@spec.name}.c".each do |file| + @spec.files += %W[depend #{@spec.name}.c].each do |file| write_file File.join(@tempdir, file) end @@ -1909,7 +1909,7 @@ def get_bin_env if win_platform? "" else - %w(/usr/bin/env /bin/env).find {|f| File.executable?(f) } + %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } end end @@ -2057,7 +2057,7 @@ def test_write_spec_writes_cached_spec def test_dir installer = setup_base_installer - assert_match %r!/gemhome/gems/a-2$!, installer.dir + assert_match %r{/gemhome/gems/a-2$}, installer.dir end def test_default_gem_loaded_from @@ -2097,7 +2097,7 @@ def test_default_gem_without_wrappers assert_path_exists installed_exec wrapper = File.read installed_exec - refute_match %r|generated by RubyGems|, wrapper + refute_match %r{generated by RubyGems}, wrapper end def test_default_gem_with_wrappers @@ -2117,7 +2117,7 @@ def test_default_gem_with_wrappers assert_path_exists installed_exec wrapper = File.read installed_exec - assert_match %r|generated by RubyGems|, wrapper + assert_match %r{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 64ceda39b235..eb203916c5db 100644 --- a/test/rubygems/test_gem_package.rb +++ b/test/rubygems/test_gem_package.rb @@ -929,8 +929,8 @@ def test_verify_nonexistent package.verify end - assert_match %r%^No such file or directory%, e.message - assert_match %r%nonexistent.gem$%, e.message + assert_match %r{^No such file or directory}, e.message + assert_match %r{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 4df918094481..c9779aed5d76 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -499,7 +499,7 @@ def fetcher.fetch_http(uri, mtime = nil, head = nil) fetcher.fetch_path url end - assert_match %r|ECONNREFUSED:.*connect\(2\) \(#{Regexp.escape url}\)\z|, + assert_match %r{ECONNREFUSED:.*connect\(2\) \(#{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 2a756eaad793..126bb1364333 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -251,11 +251,11 @@ def test_fetch_unmodified def test_user_agent ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r%^RubyGems/\S+ \S+ Ruby/\S+ \(.*?\)%, ua - 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 %r{^RubyGems/\S+ \S+ Ruby/\S+ \(.*?\)}, ua + 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 end def test_user_agent_engine @@ -266,7 +266,7 @@ def test_user_agent_engine ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r%\) vroom%, ua + assert_match %r{\) vroom}, ua ensure util_restore_version end @@ -279,7 +279,7 @@ def test_user_agent_engine_ruby ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r%\)%, ua + assert_match %r{\)}, ua ensure util_restore_version end @@ -292,7 +292,7 @@ def test_user_agent_patchlevel ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r% patchlevel 5\)%, ua + assert_match %r{ patchlevel 5\)}, ua ensure util_restore_version end @@ -307,8 +307,8 @@ def test_user_agent_revision ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r% revision 6\)%, ua - assert_match %r%Ruby/#{Regexp.escape RUBY_VERSION}dev%, ua + assert_match %r{ revision 6\)}, ua + assert_match %r{Ruby/#{Regexp.escape RUBY_VERSION}dev}, ua ensure util_restore_version end @@ -322,7 +322,7 @@ def test_user_agent_revision_missing ua = make_request(@uri, nil, nil, nil).user_agent - assert_match %r%\(#{Regexp.escape RUBY_RELEASE_DATE}\)%, ua + assert_match %r{\(#{Regexp.escape RUBY_RELEASE_DATE}\)}, ua ensure util_restore_version end diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb index fb718294710f..f7a9191cd0b4 100644 --- a/test/rubygems/test_gem_request_set.rb +++ b/test/rubygems/test_gem_request_set.rb @@ -493,7 +493,7 @@ def test_sorted_requests rs.resolve StaticSet.new([a, b, c]) names = rs.sorted_requests.map { |s| s.full_name } - assert_equal %w!c-2 b-2 a-2!, names + assert_equal %w[c-2 b-2 a-2], names end def test_install @@ -551,7 +551,7 @@ def test_install_into assert_path_exists File.join @tempdir, 'specifications', 'a-1.gemspec' assert_path_exists File.join @tempdir, 'specifications', 'b-1.gemspec' - assert_equal %w!b-1 a-1!, installed.map { |s| s.full_name } + assert_equal %w[b-1 a-1], installed.map { |s| s.full_name } end def test_install_into_development_shallow diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb index f3d4c6fc7280..bb261ee9cb5b 100644 --- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb +++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb @@ -49,7 +49,7 @@ def test_gempspec_with_multiple_runtime_deps s.add_runtime_dependency 'bar', '>= 1.6.0', '< 1.6.4' end @gda.gemspec - assert_equal %w{ foo bar }.sort, @set.dependencies.map(&:name).sort + assert_equal %w[ foo bar ].sort, @set.dependencies.map(&:name).sort bar = @set.dependencies.find { |d| d.name == 'bar' } assert_equal [["<", Gem::Version.create('1.6.4')], [">=", Gem::Version.create('1.6.0')]], bar.requirement.requirements.sort diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb index c35a2647418b..7ace86caea25 100644 --- a/test/rubygems/test_gem_resolver.rb +++ b/test/rubygems/test_gem_resolver.rb @@ -546,7 +546,7 @@ def test_raises_when_possibles_are_exhausted dependency = e.conflict.dependency - assert_includes %w(a b), dependency.name + assert_includes %w[a b], dependency.name assert_equal req('>= 0'), dependency.requirement activated = e.conflict.activated diff --git a/test/rubygems/test_gem_security_signer.rb b/test/rubygems/test_gem_security_signer.rb index 08e74e6276e1..b9d5e9848f9a 100644 --- a/test/rubygems/test_gem_security_signer.rb +++ b/test/rubygems/test_gem_security_signer.rb @@ -191,7 +191,7 @@ def test_sign_expired_auto_update_exists signer.sign 'hello' end - assert_match %r%certificate /CN=nobody/DC=example not valid%, e.message + assert_match %r{certificate /CN=nobody/DC=example not valid}, e.message end def test_sign_no_key diff --git a/test/rubygems/test_gem_server.rb b/test/rubygems/test_gem_server.rb index ca9ba4bf9c35..350a21d1d66c 100644 --- a/test/rubygems/test_gem_server.rb +++ b/test/rubygems/test_gem_server.rb @@ -88,7 +88,7 @@ def test_latest_specs end assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/octet-stream', @res['content-type'] assert_equal [['a', Gem::Version.new(2), Gem::Platform::RUBY]], Marshal.load(@res.body) @@ -127,7 +127,7 @@ def test_latest_specs_gz end assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/x-gzip', @res['content-type'] assert_equal [['a', Gem::Version.new(2), Gem::Platform::RUBY]], Marshal.load(Gem::Util.gunzip(@res.body)) @@ -162,7 +162,7 @@ def test_prerelease_specs end assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/octet-stream', @res['content-type'] assert_equal [['a', v('3.a'), Gem::Platform::RUBY]], Marshal.load(@res.body) @@ -177,7 +177,7 @@ def test_prerelease_specs_gz end assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/x-gzip', @res['content-type'] assert_equal [['a', v('3.a'), Gem::Platform::RUBY]], Marshal.load(Gem::Util.gunzip(@res.body)) @@ -223,7 +223,7 @@ def test_quick_missing @server.quick @req, @res assert_equal 404, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'text/plain', @res['content-type'] assert_equal 'No gems found matching "z-9"', @res.body assert_equal 404, @res.status @@ -320,7 +320,7 @@ def test_rdoc @server.rdoc @req, @res assert_equal 200, @res.status, @res.body - assert_match %r|No documentation found|, @res.body + assert_match %r{No documentation found}, @res.body assert_equal 'text/html', @res['content-type'] end @@ -331,7 +331,7 @@ def test_root @server.root @req, @res assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'text/html', @res['content-type'] end @@ -529,7 +529,7 @@ def test_specs @server.specs @req, @res assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/octet-stream', @res['content-type'] assert_equal [['a', Gem::Version.new(1), Gem::Platform::RUBY], @@ -569,7 +569,7 @@ def test_specs_gz @server.specs @req, @res assert_equal 200, @res.status, @res.body - assert_match %r| \d\d:\d\d:\d\d |, @res['date'] + assert_match %r{ \d\d:\d\d:\d\d }, @res['date'] assert_equal 'application/x-gzip', @res['content-type'] assert_equal [['a', Gem::Version.new(1), Gem::Platform::RUBY], @@ -591,7 +591,7 @@ def test_regression_1793 @server.root @req, @res - refute_match %r|%3A%2F%2F|, @res.body + refute_match %r{%3A%2F%2F}, @res.body end def util_listen diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 4e8e356320a6..5a36bc50c522 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -140,12 +140,12 @@ def test_self_activate_ambiguous_direct install_specs c1, c2, b1, b2, a1 a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names require "d#{$$}" - assert_equal %w(a-1 b-2 c-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2], loaded_spec_names assert_equal [], unresolved_names end end @@ -187,12 +187,12 @@ def test_self_activate_ambiguous_indirect install_specs c1, c2, b1, b2, a1 a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names require "d#{$$}" - assert_equal %w(a-1 b-2 c-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2], loaded_spec_names assert_equal [], unresolved_names end end @@ -209,12 +209,12 @@ def test_self_activate_ambiguous_indirect_conflict install_specs c1, b1, a1, a2, c2, b2 a2.activate - assert_equal %w(a-2), loaded_spec_names + assert_equal %w[a-2], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names require "d#{$$}" - assert_equal %w(a-2 b-1 c-1), loaded_spec_names + assert_equal %w[a-2 b-1 c-1], loaded_spec_names assert_equal [], unresolved_names end end @@ -231,12 +231,12 @@ def test_self_activate_ambiguous_unrelated install_specs d1, c1, c2, b1, b2, a1 a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names require "d#{$$}" - assert_equal %w(a-1 d-1), loaded_spec_names + assert_equal %w[a-1 d-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names end end @@ -255,7 +255,7 @@ def test_require_should_prefer_latest_gem_level1 require "c#{$$}" - assert_equal %w(a-1 b-2 c-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2], loaded_spec_names end end @@ -275,7 +275,7 @@ def test_require_should_prefer_latest_gem_level2 require "d#{$$}" - assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names end end @@ -296,7 +296,7 @@ def test_require_finds_in_2nd_level_indirect require "d#{$$}" - assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names end end @@ -318,7 +318,7 @@ def test_require_should_prefer_reachable_gems require "d#{$$}" - assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names end end @@ -336,12 +336,12 @@ def test_require_should_not_conflict install_specs c1, c2, c3, b1, b2, a1, a2, base base.activate - assert_equal %w(0-1), loaded_spec_names + assert_equal %w[0-1], loaded_spec_names assert_equal ["A (>= 1)"], unresolved_names require "d#{$$}" - assert_equal %w(0-1 A-2 b-2 c-2), loaded_spec_names + assert_equal %w[0-1 A-2 b-2 c-2], loaded_spec_names assert_equal [], unresolved_names end end @@ -364,7 +364,7 @@ def test_inner_clonflict_in_indirect_gems require "d#{$$}" - assert_includes [%w(a-1 b-2 c-3 d-2),%w(a-1 b-2 d-2)], loaded_spec_names + assert_includes [%w[a-1 b-2 c-3 d-2],%w[a-1 b-2 d-2]], loaded_spec_names end end @@ -386,7 +386,7 @@ def test_inner_clonflict_in_indirect_gems_reversed require "d#{$$}" - assert_includes [%w(a-1 b-2 d-2 xc-3), %w(a-1 b-2 d-2)], loaded_spec_names + assert_includes [%w[a-1 b-2 d-2 xc-3], %w[a-1 b-2 d-2]], loaded_spec_names end end @@ -515,7 +515,7 @@ def test_self_activate_via_require require "b/c" end - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names end def test_self_activate_via_require_wtf @@ -532,7 +532,7 @@ def test_self_activate_via_require_wtf a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal ["b (> 0)", "d (> 0)"], unresolved_names require "b#{$$}" @@ -543,7 +543,7 @@ def test_self_activate_via_require_wtf assert_equal "unable to find a version of 'd' to activate", e.message - assert_equal %w(a-1 b-2 c-2), loaded_spec_names + assert_equal %w[a-1 b-2 c-2], loaded_spec_names assert_equal ["d (> 0)"], unresolved_names end end @@ -558,7 +558,7 @@ def test_self_activate_deep_unambiguous install_specs c1, c2, b1, b2, a1 a1.activate - assert_equal %w(a-1 b-1 c-1), loaded_spec_names + assert_equal %w[a-1 b-1 c-1], loaded_spec_names end def test_self_activate_loaded @@ -795,7 +795,7 @@ def test_self_from_yaml_syck_default_key_bug op = spec.dependencies.first.requirement.requirements.first.first refute_kind_of YAML::Syck::DefaultKey, op - refute_match %r%DefaultKey%, spec.to_ruby + refute_match %r{DefaultKey}, spec.to_ruby end def test_self_from_yaml_cleans_up_defaultkey @@ -829,7 +829,7 @@ def test_self_from_yaml_cleans_up_defaultkey op = spec.dependencies.first.requirement.requirements.first.first refute_kind_of YAML::Syck::DefaultKey, op - refute_match %r%DefaultKey%, spec.to_ruby + refute_match %r{DefaultKey}, spec.to_ruby end def test_self_from_yaml_cleans_up_defaultkey_from_newer_192 @@ -863,7 +863,7 @@ def test_self_from_yaml_cleans_up_defaultkey_from_newer_192 op = spec.dependencies.first.requirement.requirements.first.first refute_kind_of YAML::Syck::DefaultKey, op - refute_match %r%DefaultKey%, spec.to_ruby + refute_match %r{DefaultKey}, spec.to_ruby end def test_self_from_yaml_cleans_up_Date_objects @@ -1910,11 +1910,11 @@ class << Gem end def test_files - @a1.files = %w(files bin/common) - @a1.test_files = %w(test_files bin/common) - @a1.executables = %w(executables common) - @a1.extra_rdoc_files = %w(extra_rdoc_files bin/common) - @a1.extensions = %w(extensions bin/common) + @a1.files = %w[files bin/common] + @a1.test_files = %w[test_files bin/common] + @a1.executables = %w[executables common] + @a1.extra_rdoc_files = %w[extra_rdoc_files bin/common] + @a1.extensions = %w[extensions bin/common] expected = %w[ bin/common @@ -1928,11 +1928,11 @@ def test_files end def test_files_append - @a1.files = %w(files bin/common) - @a1.test_files = %w(test_files bin/common) - @a1.executables = %w(executables common) - @a1.extra_rdoc_files = %w(extra_rdoc_files bin/common) - @a1.extensions = %w(extensions bin/common) + @a1.files = %w[files bin/common] + @a1.test_files = %w[test_files bin/common] + @a1.executables = %w[executables common] + @a1.extra_rdoc_files = %w[extra_rdoc_files bin/common] + @a1.extensions = %w[extensions bin/common] expected = %w[ bin/common @@ -2321,12 +2321,12 @@ def test_require_already_activated install_specs a1 # , a2, b1, b2, c1, c2 a1.activate - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal [], unresolved_names assert require "d#{$$}" - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal [], unresolved_names end end @@ -2344,12 +2344,12 @@ def test_require_already_activated_indirect_conflict a1.activate c1.activate - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names assert require "d#{$$}" - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names end end @@ -2685,7 +2685,7 @@ def test_to_yaml_fancy def test_to_yaml_platform_empty_string @a1.instance_variable_set :@original_platform, '' - assert_match %r|^platform: ruby$|, @a1.to_yaml + assert_match %r{^platform: ruby$}, @a1.to_yaml end def test_to_yaml_platform_legacy @@ -2703,7 +2703,7 @@ def test_to_yaml_platform_legacy def test_to_yaml_platform_nil @a1.instance_variable_set :@original_platform, nil - assert_match %r|^platform: ruby$|, @a1.to_yaml + assert_match %r{^platform: ruby$}, @a1.to_yaml end def test_validate @@ -2747,7 +2747,7 @@ def test_validate_authors @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not an author}, e.message + assert_equal %("#{f}" or "#{t}" is not an author), e.message @a1.authors = ["#{t} (who is writing this software)"] @@ -2755,7 +2755,7 @@ def test_validate_authors @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not an author}, e.message + assert_equal %("#{f}" or "#{t}" is not an author), e.message end end @@ -2907,7 +2907,7 @@ def test_validate_description @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not a description}, e.message + assert_equal %("#{f}" or "#{t}" is not a description), e.message @a1.description = "#{t} (describe your package)" @@ -2915,7 +2915,7 @@ def test_validate_description @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not a description}, e.message + assert_equal %("#{f}" or "#{t}" is not a description), e.message end end @@ -2929,7 +2929,7 @@ def test_validate_email @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not an email}, e.message + assert_equal %("#{f}" or "#{t}" is not an email), e.message @a1.email = "#{t} (your e-mail)" @@ -2937,7 +2937,7 @@ def test_validate_email @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not an email}, e.message + assert_equal %("#{f}" or "#{t}" is not an email), e.message end end @@ -3339,7 +3339,7 @@ def test_validate_non_nil spec.validate end - assert_match %r%^#{name}%, e.message + assert_match %r{^#{name}}, e.message end end end @@ -3439,7 +3439,7 @@ def test_validate_summary @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message + assert_equal %("#{f}" or "#{t}" is not a summary), e.message @a1.summary = "#{t} (describe your package)" @@ -3447,7 +3447,7 @@ def test_validate_summary @a1.validate end - assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message + assert_equal %("#{f}" or "#{t}" is not a summary), e.message end end diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index fc330a604034..9a98c1e590fe 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -27,7 +27,7 @@ def test_initialize_expand_path FileUtils.mkdir_p 'foo/bar' uninstaller = Gem::Uninstaller.new nil, :install_dir => 'foo//bar' - assert_match %r|foo/bar$|, uninstaller.instance_variable_get(:@gem_home) + assert_match %r{foo/bar$}, uninstaller.instance_variable_get(:@gem_home) end def test_ask_if_ok @@ -458,12 +458,12 @@ def test_uninstall_prompts_about_broken_deps lines = ui.output.split("\n") lines.shift - assert_match %r!You have requested to uninstall the gem:!, lines.shift + assert_match %r{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{r-1 depends on q \(= 1\)}, lines.shift + assert_match %r{Successfully uninstalled q-1}, lines.last end def test_uninstall_only_lists_unsatisfied_deps @@ -488,12 +488,12 @@ def test_uninstall_only_lists_unsatisfied_deps lines = ui.output.split("\n") lines.shift - assert_match %r!You have requested to uninstall the gem:!, lines.shift + assert_match %r{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 %r{x-1 depends on q \(= 1.0\)}, lines.shift + assert_match %r{Successfully uninstalled q-1.0}, lines.last end def test_uninstall_doesnt_prompt_when_other_gem_satisfies_requirement @@ -569,12 +569,12 @@ def test_uninstall_prompt_includes_dep_type lines = ui.output.split("\n") lines.shift - assert_match %r!You have requested to uninstall the gem:!, lines.shift + assert_match %r{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{r-1 depends on q \(= 1, development\)}, lines.shift + assert_match %r{Successfully uninstalled q-1}, lines.last end def test_uninstall_prompt_only_lists_the_dependents_that_prevented_uninstallation @@ -598,12 +598,12 @@ def test_uninstall_prompt_only_lists_the_dependents_that_prevented_uninstallatio lines = ui.output.split("\n") lines.shift - assert_match %r!You have requested to uninstall the gem:!, lines.shift + assert_match %r{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 %r{s-1 depends on q \(= 1\)}, lines.shift + assert_match %r{Successfully uninstalled q-1}, lines.last end def test_uninstall_no_permission diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 67c55416d4c1..7b071ba88f7c 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -70,7 +70,7 @@ def test_dash_i_beats_gems assert_require 'test_gem_require_a' assert_require 'b/c' # this should be required from -I assert_equal "world", ::Object::HELLO - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names ensure $LOAD_PATH.replace lp Object.send :remove_const, :HELLO if Object.const_defined? :HELLO @@ -114,7 +114,7 @@ def test_dash_i_beats_default_gems assert_require 'b/c' assert_require 'c/c' # this should be required from -I assert_equal "world", ::Object::HELLO - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names ensure $LOAD_PATH.replace lp Object.send :remove_const, :HELLO if Object.const_defined? :HELLO @@ -171,11 +171,11 @@ def test_require_is_not_lazy_with_exact_req install_specs b1, b2, a1 assert_require 'test_gem_require_a' - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names assert_equal unresolved_names, [] assert_require "b/c" - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names end def test_require_is_lazy_with_inexact_req @@ -186,11 +186,11 @@ def test_require_is_lazy_with_inexact_req install_specs b1, b2, a1 assert_require 'test_gem_require_a' - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal unresolved_names, ["b (>= 1)"] assert_require "b/c" - assert_equal %w(a-1 b-2), loaded_spec_names + assert_equal %w[a-1 b-2], loaded_spec_names end def test_require_is_not_lazy_with_one_possible @@ -200,11 +200,11 @@ def test_require_is_not_lazy_with_one_possible install_specs b1, a1 assert_require 'test_gem_require_a' - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names assert_equal unresolved_names, [] assert_require "b/c" - assert_equal %w(a-1 b-1), loaded_spec_names + assert_equal %w[a-1 b-1], loaded_spec_names end def test_require_can_use_a_pathname_object @@ -213,7 +213,7 @@ def test_require_can_use_a_pathname_object install_specs a1 assert_require Pathname.new 'test_gem_require_a' - assert_equal %w(a-1), loaded_spec_names + assert_equal %w[a-1], loaded_spec_names assert_equal unresolved_names, [] end @@ -246,7 +246,7 @@ def test_activate_via_require_respects_loaded_files # This case is fine because our lazy loading is provided exactly # the same behavior as eager loading would have. - assert_equal %w(a-1 b-2), loaded_spec_names + assert_equal %w[a-1 b-2], loaded_spec_names ensure $LOAD_PATH.replace lp unless java_platform? end @@ -262,12 +262,12 @@ def test_already_activated_direct_conflict a1.activate c1.activate - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names assert require("ib") - assert_equal %w(a-1 b-1 c-1), loaded_spec_names + assert_equal %w[a-1 b-1 c-1], loaded_spec_names assert_equal [], unresolved_names end @@ -284,7 +284,7 @@ def test_multiple_gems_with_the_same_path a1.activate c1.activate - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)", "x (> 0)"], unresolved_names e = assert_raises(Gem::LoadError) do @@ -307,7 +307,7 @@ def test_unable_to_find_good_unresolved_version a1.activate c1.activate - assert_equal %w(a-1 c-1), loaded_spec_names + assert_equal %w[a-1 c-1], loaded_spec_names assert_equal ["b (> 0)"], unresolved_names e = assert_raises(Gem::LoadError) do @@ -338,9 +338,9 @@ def test_require_works_after_cleanup # Require gems that have not been removed. assert_require 'a/b' - assert_equal %w(a-1.0), loaded_spec_names + assert_equal %w[a-1.0], loaded_spec_names assert_require 'b/d' - assert_equal %w(a-1.0 b-2.0), loaded_spec_names + assert_equal %w[a-1.0 b-2.0], loaded_spec_names end def test_require_doesnt_traverse_development_dependencies @@ -352,7 +352,7 @@ def test_require_doesnt_traverse_development_dependencies install_specs a, w1, w2, z assert gem("z") - assert_equal %w(z-1), loaded_spec_names + assert_equal %w[z-1], loaded_spec_names assert_equal ["w (> 0)"], unresolved_names assert require("a#{$$}") @@ -363,7 +363,7 @@ def test_default_gem_only nil, "default/gem.rb") install_default_specs(default_gem_spec) assert_require "default/gem" - assert_equal %w(default-2.0.0.0), loaded_spec_names + assert_equal %w[default-2.0.0.0], loaded_spec_names end def test_default_gem_require_activates_just_once @@ -403,7 +403,7 @@ def test_default_gem_and_normal_gem "lib/default/gem.rb") install_specs(normal_gem_spec) assert_require "default/gem" - assert_equal %w(default-3.0), loaded_spec_names + assert_equal %w[default-3.0], loaded_spec_names end def test_default_gem_prerelease @@ -416,7 +416,7 @@ def test_default_gem_prerelease install_default_specs(normal_gem_higher_prerelease_spec) assert_require "default/gem" - assert_equal %w(default-3.0.0.rc2), loaded_spec_names + assert_equal %w[default-3.0.0.rc2], loaded_spec_names end def loaded_spec_names @@ -462,7 +462,7 @@ def self.gem(*args) end end assert c.send(:require, "default/gem") - assert_equal %w(default-2.0.0.0), loaded_spec_names + assert_equal %w[default-2.0.0.0], loaded_spec_names end def test_require_default_when_gem_defined @@ -474,7 +474,7 @@ def self.gem(*args) end end assert c.send(:require, "a#{$$}") - assert_equal %W(a#{$$}-1), loaded_spec_names + assert_equal %W[a#{$$}-1], loaded_spec_names end def test_require_bundler