diff --git a/.rubocop.yml b/.rubocop.yml index 370a448f8042..da42fcc1bbca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -73,6 +73,9 @@ Layout/LeadingEmptyLines: Layout/SpaceAroundOperators: Enabled: true +Layout/SpaceBeforeBlockBraces: + Enabled: true + Layout/SpaceInsideBlockBraces: Enabled: true SpaceBeforeBlockParameters: false diff --git a/.rubocop_bundler.yml b/.rubocop_bundler.yml index 55c060ded05d..4f716b7f293e 100644 --- a/.rubocop_bundler.yml +++ b/.rubocop_bundler.yml @@ -373,6 +373,9 @@ Layout/SpaceInsideArrayLiteralBrackets: Layout/SpaceInsideArrayPercentLiteral: Enabled: true +Layout/SpaceBeforeBlockBraces: + Enabled: true + Layout/SpaceInsideBlockBraces: Enabled: true SpaceBeforeBlockParameters: false diff --git a/bundler/lib/bundler/cli/common.rb b/bundler/lib/bundler/cli/common.rb index 1a469f1d3496..b547619c6af2 100644 --- a/bundler/lib/bundler/cli/common.rb +++ b/bundler/lib/bundler/cli/common.rb @@ -40,7 +40,7 @@ def self.without_groups_message(command) end def self.verbalize_groups(groups) - groups.map!{|g| "'#{g}'" } + groups.map! {|g| "'#{g}'" } group_list = [groups[0...-1].join(", "), groups[-1..-1]]. reject {|s| s.to_s.empty? }.join(" and ") group_str = groups.size == 1 ? "group" : "groups" diff --git a/bundler/lib/bundler/definition.rb b/bundler/lib/bundler/definition.rb index d862877c2e4b..4fca763bcce5 100644 --- a/bundler/lib/bundler/definition.rb +++ b/bundler/lib/bundler/definition.rb @@ -261,7 +261,7 @@ def resolve @locked_specs elsif !unlocking? && nothing_changed? Bundler.ui.debug("Found no changes, using resolution from the lockfile") - SpecSet.new(filter_specs(@locked_specs, @dependencies.select{|dep| @locked_specs[dep].any? })) + SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? })) else last_resolve = converge_locked_specs # Run a resolve against the locally available gems @@ -731,7 +731,7 @@ def converge_specs(specs) end end - SpecSet.new(filter_specs(converged, deps).reject{|s| @unlock[:gems].include?(s.name) }) + SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) }) end def metadata_dependencies diff --git a/bundler/lib/bundler/dsl.rb b/bundler/lib/bundler/dsl.rb index f7922b1fba01..8983ef3e2baa 100644 --- a/bundler/lib/bundler/dsl.rb +++ b/bundler/lib/bundler/dsl.rb @@ -46,7 +46,7 @@ def eval_gemfile(gemfile, contents = nil) @gemfile = expanded_gemfile_path @gemfiles << expanded_gemfile_path contents ||= Bundler.read_file(@gemfile.to_s) - instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1) + instance_eval(contents.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1) rescue Exception => e # rubocop:disable Lint/RescueException message = "There was an error " \ "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \ diff --git a/bundler/lib/bundler/gem_helpers.rb b/bundler/lib/bundler/gem_helpers.rb index b271b8d22922..632698482f39 100644 --- a/bundler/lib/bundler/gem_helpers.rb +++ b/bundler/lib/bundler/gem_helpers.rb @@ -48,7 +48,7 @@ def select_best_platform_match(specs, platform) sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) } exemplary_spec = sorted_matching.first - sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) } + sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) } end module_function :select_best_platform_match diff --git a/bundler/lib/bundler/resolver.rb b/bundler/lib/bundler/resolver.rb index 433a5e53e1e6..2285114c5708 100644 --- a/bundler/lib/bundler/resolver.rb +++ b/bundler/lib/bundler/resolver.rb @@ -21,7 +21,7 @@ def self.resolve(requirements, source_requirements = {}, base = [], gem_version_ base = SpecSet.new(base) unless base.is_a?(SpecSet) resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms) result = resolver.start(requirements) - SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") })) + SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") })) end def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms) diff --git a/bundler/lib/bundler/rubygems_ext.rb b/bundler/lib/bundler/rubygems_ext.rb index b0e35e005ea2..af669d7d0bbc 100644 --- a/bundler/lib/bundler/rubygems_ext.rb +++ b/bundler/lib/bundler/rubygems_ext.rb @@ -34,7 +34,7 @@ def source def full_gem_path if source.respond_to?(:root) - Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" } else rg_full_gem_path end diff --git a/bundler/lib/bundler/shared_helpers.rb b/bundler/lib/bundler/shared_helpers.rb index ffdbdee5034e..8c4e26f074ec 100644 --- a/bundler/lib/bundler/shared_helpers.rb +++ b/bundler/lib/bundler/shared_helpers.rb @@ -13,13 +13,13 @@ module SharedHelpers def root gemfile = find_gemfile raise GemfileNotFound, "Could not locate Gemfile" unless gemfile - Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent + Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent end def default_gemfile gemfile = find_gemfile raise GemfileNotFound, "Could not locate Gemfile" unless gemfile - Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path + Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path end def default_lockfile @@ -28,7 +28,7 @@ def default_lockfile case gemfile.basename.to_s when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked")) else Pathname.new("#{gemfile}.lock") - end.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + end.tap {|x| x.untaint if RUBY_VERSION < "2.7" } end def default_bundle_dir @@ -100,7 +100,7 @@ def set_bundle_environment # # @see {Bundler::PermissionError} def filesystem_access(path, action = :write, &block) - yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }) + yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }) rescue Errno::EACCES raise PermissionError.new(path, action) rescue Errno::EAGAIN @@ -236,7 +236,7 @@ def find_directory(*names) def search_up(*names) previous = nil - current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" } + current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" } until !File.directory?(current) || current == previous if ENV["BUNDLER_SPEC_RUN"] diff --git a/bundler/lib/bundler/source/git.rb b/bundler/lib/bundler/source/git.rb index f1741207063d..eb82544b8608 100644 --- a/bundler/lib/bundler/source/git.rb +++ b/bundler/lib/bundler/source/git.rb @@ -336,7 +336,7 @@ def validate_spec(_spec); end def load_gemspec(file) stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent) - stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" } StubSpecification.from_stub(stub) end diff --git a/bundler/lib/bundler/spec_set.rb b/bundler/lib/bundler/spec_set.rb index a19d18388ab8..352656aa7acd 100644 --- a/bundler/lib/bundler/spec_set.rb +++ b/bundler/lib/bundler/spec_set.rb @@ -18,7 +18,7 @@ def for(dependencies, check = false, match_current_platform = false) loop do break unless dep = deps.shift - next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler" + next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler" handled << dep @@ -172,7 +172,7 @@ def tsort_each_node def spec_for_dependency(dep, match_current_platform) specs_for_platforms = lookup[dep.name] if match_current_platform - GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) + GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) else GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform) end diff --git a/bundler/spec/runtime/inline_spec.rb b/bundler/spec/runtime/inline_spec.rb index 9029c9b854e3..dd22c86f9045 100644 --- a/bundler/spec/runtime/inline_spec.rb +++ b/bundler/spec/runtime/inline_spec.rb @@ -89,7 +89,7 @@ def script(code, options = {}) expect(out).to include("Installing activesupport") err_lines = err.split("\n") - err_lines.reject!{|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7" + err_lines.reject! {|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7" expect(err_lines).to be_empty end diff --git a/bundler/spec/support/rubygems_ext.rb b/bundler/spec/support/rubygems_ext.rb index d7f5d33fe9af..eb7e3210804d 100644 --- a/bundler/spec/support/rubygems_ext.rb +++ b/bundler/spec/support/rubygems_ext.rb @@ -119,7 +119,7 @@ def gem_activate_and_possibly_install(gem_name) def gem_activate(gem_name) require "bundler" - gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).specs.find{|spec| spec.name == gem_name }.version + gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).specs.find {|spec| spec.name == gem_name }.version gem gem_name, gem_requirement end diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 137c08610b7a..e46dac0fd7d6 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -117,7 +117,7 @@ module Gem # Taint support is deprecated in Ruby 2.7. # This allows switching ".untaint" to ".tap(&Gem::UNTAINT)", # to avoid deprecation warnings in Ruby 2.7. - UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{} + UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc {} # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" || diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 3cf496ba5b85..030c1bffcea0 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -113,7 +113,7 @@ def execute end.flatten end - specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY } + specs = specs.select {|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY } if specs.to_a.empty? raise Gem::Exception, diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 7b6890013c20..84e9210cfb50 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -475,7 +475,7 @@ def generate_default_dirs def files_in(dir) Dir.chdir dir do Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH). - select{|f| !File.directory?(f) } + select {|f| !File.directory?(f) } end end diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 6f247879622d..6fba3a36ece4 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -129,7 +129,7 @@ def execute platform = get_platform_from_requirements(options) if platform - specs = specs.select{|s| s.platform.to_s == platform } + specs = specs.select {|s| s.platform.to_s == platform } end unless options[:all] diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 5c1674f2e8fd..061339989071 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -725,11 +725,11 @@ def verify_spec raise Gem::InstallError, "#{spec} has an invalid name" end - if spec.raw_require_paths.any?{|path| path =~ /\R/ } + if spec.raw_require_paths.any? {|path| path =~ /\R/ } raise Gem::InstallError, "#{spec} has an invalid require_paths" end - if spec.extensions.any?{|ext| ext =~ /\R/ } + if spec.extensions.any? {|ext| ext =~ /\R/ } raise Gem::InstallError, "#{spec} has an invalid extensions" end diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb index 0b8b0ee1a60c..9811c8f9484d 100644 --- a/lib/rubygems/local_remote_options.rb +++ b/lib/rubygems/local_remote_options.rb @@ -26,7 +26,7 @@ def accept_uri_http valid_uri_schemes = ["http", "https", "file", "s3"] unless valid_uri_schemes.include?(uri.scheme) - msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://" }}" + msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map {|s| "#{s}://" }}" raise ArgumentError, msg end diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index f4cfea308770..e0c71c43cbef 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -61,7 +61,7 @@ def execute gem_names = if args.empty? [options[:name]] else - options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i } + options[:exact] ? args.map {|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map {|arg| /#{arg}/i } end terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems? diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 15bfbb6f8d29..4033e2efa325 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -91,8 +91,8 @@ def search_for_dependency(dependency, matching_platform=true) list.each do |source, specs| if dependency.name.is_a?(String) && specs.respond_to?(:bsearch) - start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name } - end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name } + start_index = (0 ... specs.length).bsearch {|i| specs[i].name >= dependency.name } + end_index = (0 ... specs.length).bsearch {|i| specs[i].name > dependency.name } specs = specs[start_index ... end_index] if start_index && end_index end diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 7e7599f7dbf9..9b533caf54bf 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1110,7 +1110,7 @@ def self._latest_specs(specs, prerelease = false) # :nodoc: result[spec.name] = spec end - result.map(&:last).flatten.sort_by{|tup| tup.name } + result.map(&:last).flatten.sort_by {|tup| tup.name } end ## diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index 4460df8319f5..a0b2c985055a 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -1294,7 +1294,7 @@ def ruby_with_rubygems_in_load_path end def rubygems_path - $LOAD_PATH.find{|p| p == File.dirname($LOADED_FEATURES.find{|f| f.end_with?("/rubygems.rb") }) } + $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) } end def with_clean_path_to_ruby diff --git a/test/rubygems/package/tar_test_case.rb b/test/rubygems/package/tar_test_case.rb index 99f503a23f13..4517f407303e 100644 --- a/test/rubygems/package/tar_test_case.rb +++ b/test/rubygems/package/tar_test_case.rb @@ -67,7 +67,7 @@ def assert_headers_equal(expected, actual) end def calc_checksum(header) - sum = header.unpack("C*").inject{|s,a| s + a } + sum = header.unpack("C*").inject {|s,a| s + a } SP(Z(to_oct(sum, 6))) end diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 0ff8b4a1db65..53fb058e99d3 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1061,7 +1061,7 @@ def test_self_refresh_keeps_loaded_specs_activated Gem.refresh - Gem::Specification.each{|spec| assert spec.activated? if spec == s } + Gem::Specification.each {|spec| assert spec.activated? if spec == s } Gem.loaded_specs.delete(s) Gem.refresh diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb index d79174717b7b..cf93d81e7eac 100644 --- a/test/rubygems/test_gem_commands_contents_command.rb +++ b/test/rubygems/test_gem_commands_contents_command.rb @@ -239,7 +239,7 @@ def test_execute_default_gem [RbConfig::CONFIG['bindir'], 'default_command'], [RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'], [RbConfig::CONFIG['archdir'], 'default_gem.so'], - ].sort.map{|a|File.join a }.join "\n" + ].sort.map {|a|File.join a }.join "\n" assert_equal expected, @ui.output.chomp assert_equal "", @ui.error diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 47a97dae4bea..6127fcc1240d 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -521,7 +521,7 @@ def test_execute_prerelease_skipped_when_non_pre_available end def test_execute_required_ruby_version - next_ruby = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".") + next_ruby = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") local = Gem::Platform.local spec_fetcher do |fetcher| @@ -610,7 +610,7 @@ def test_execute_required_ruby_version_specific_prerelease_met end def test_execute_required_ruby_version_specific_prerelease_not_met - next_ruby_pre = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".") + ".a" + next_ruby_pre = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") + ".a" spec_fetcher do |fetcher| fetcher.gem 'a', '1.0' do |s| diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb index 4007c3a69cee..775085964e1b 100644 --- a/test/rubygems/test_gem_request_set_lockfile_parser.rb +++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb @@ -248,7 +248,7 @@ def test_parse_GEM_remote_multiple assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name } assert_equal %w[https://gems.example/ https://other.example/], - lockfile_set.specs.flat_map {|s| s.sources.map{|src| src.uri.to_s } } + lockfile_set.specs.flat_map {|s| s.sources.map {|src| src.uri.to_s } } end def test_parse_GIT diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb index 928a16b9d351..7a6d17f2b0d5 100644 --- a/test/rubygems/test_gem_resolver_installer_set.rb +++ b/test/rubygems/test_gem_resolver_installer_set.rb @@ -210,7 +210,7 @@ def test_prefetch def (set.remote_set).prefetch(_) raise "called" end - assert_raise(RuntimeError){ set.prefetch(nil) } + assert_raise(RuntimeError) { set.prefetch(nil) } set = Gem::Resolver::InstallerSet.new :local def (set.remote_set).prefetch(_) diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 55dd7f0ff2d5..8b0477c4dd61 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -992,8 +992,8 @@ def test_self_stubs_for_lazy_loading dir_standard_specs = File.join Gem.dir, 'specifications' - save_gemspec('a-1', '1', dir_standard_specs){|s| s.name = 'a' } - save_gemspec('b-1', '1', dir_standard_specs){|s| s.name = 'b' } + save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' } + save_gemspec('b-1', '1', dir_standard_specs) {|s| s.name = 'b' } assert_equal ['a-1'], Gem::Specification.stubs_for('a').map {|s| s.full_name } assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length @@ -1013,7 +1013,7 @@ def test_self_stubs_for_lazy_loading def test_self_stubs_for_no_lazy_loading_after_all_specs_setup Gem::Specification.all = [util_spec('a', '1')] - save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')){|s| s.name = 'b' } + save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')) {|s| s.name = 'b' } assert_equal [], Gem::Specification.stubs_for('b').map {|s| s.full_name } end @@ -1060,9 +1060,9 @@ def test_self_stubs_for_mult_platforms def test_self_stubs_returns_only_specified_named_specs dir_standard_specs = File.join Gem.dir, 'specifications' - save_gemspec('a-1', '1', dir_standard_specs){|s| s.name = 'a' } - save_gemspec('a-2', '2', dir_standard_specs){|s| s.name = 'a' } - save_gemspec('a-a', '3', dir_standard_specs){|s| s.name = 'a-a' } + save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' } + save_gemspec('a-2', '2', dir_standard_specs) {|s| s.name = 'a' } + save_gemspec('a-a', '3', dir_standard_specs) {|s| s.name = 'a-a' } assert_equal ['a-1', 'a-2'], Gem::Specification.stubs_for('a').map(&:full_name).sort end diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 8857ceef2539..9aa057442ad7 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -152,8 +152,8 @@ def test_concurrent_require install_specs a1, b1 - t1 = create_sync_thread{ assert_require "a#{$$}" } - t2 = create_sync_thread{ assert_require "b#{$$}" } + t1 = create_sync_thread { assert_require "a#{$$}" } + t2 = create_sync_thread { assert_require "b#{$$}" } # wait until both files are waiting on the exit latch FILE_ENTERED_LATCH.await diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb index 26c5f1e0fd65..cc650ff3439e 100644 --- a/test/rubygems/test_rubygems.rb +++ b/test/rubygems/test_rubygems.rb @@ -66,6 +66,6 @@ def util_install_operating_system_rb(content) end def ruby_with_rubygems_and_fake_operating_system_in_load_path(operating_system_path) - [Gem.ruby, "-I", operating_system_path, "-I" , $LOAD_PATH.find{|p| p == File.dirname($LOADED_FEATURES.find{|f| f.end_with?("/rubygems.rb") }) }] + [Gem.ruby, "-I", operating_system_path, "-I" , $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }] end end