From d9c32d62a06edf6bcfaf357e44173cefd92778ee Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 27 Feb 2015 13:00:45 +0000 Subject: [PATCH] * lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6). Fixed #1159, #1171, #1173 on rubygems/rubygems * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++ lib/rubygems/commands/pristine_command.rb | 10 +++ lib/rubygems/indexer.rb | 63 +--------------- lib/rubygems/package.rb | 3 +- lib/rubygems/request_set.rb | 4 +- .../request_set/gem_dependency_api.rb | 8 +- lib/rubygems/request_set/lockfile.rb | 75 ++++++++----------- lib/rubygems/requirement.rb | 11 +++ lib/rubygems/specification.rb | 52 ++++++++++++- lib/rubygems/test_case.rb | 15 ++++ lib/rubygems/text.rb | 2 - lib/rubygems/version.rb | 24 +++--- .../test_gem_commands_pristine_command.rb | 22 ++++++ ...test_gem_request_set_gem_dependency_api.rb | 22 +++--- .../rubygems/test_gem_request_set_lockfile.rb | 39 +++++----- test/rubygems/test_gem_specification.rb | 2 - test/rubygems/test_gem_text.rb | 2 + 17 files changed, 205 insertions(+), 155 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0938060ac..a792c22585 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Feb 27 22:00:05 2015 SHIBATA Hiroshi + + * lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6). + Fixed #1159, #1171, #1173 on rubygems/rubygems + * test/rubygems: ditto. + Fri Feb 27 20:55:42 2015 SHIBATA Hiroshi * lib/rake: Update to rake (9237e74), typo fix and remove needless diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index dcd5bb76fb..91308d83f6 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -21,6 +21,11 @@ class Gem::Commands::PristineCommand < Gem::Command options[:all] = value end + add_option('--skip=gem_name', + 'used on --all, skip if name == gem_name') do |value, options| + options[:skip] = value + end + add_option('--[no-]extensions', 'Restore gems with extensions', 'in addition to regular gems') do |value, options| @@ -109,6 +114,11 @@ extensions will be restored. next end + if spec.name == options[:skip] + say "Skipped #{spec.full_name}, it was given through options" + next + end + if spec.bundled_gem_in_old_ruby? say "Skipped #{spec.full_name}, it is bundled with old Ruby" next diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb index f94fb1bcb8..8933251b75 100644 --- a/lib/rubygems/indexer.rb +++ b/lib/rubygems/indexer.rb @@ -92,23 +92,6 @@ class Gem::Indexer @files = [] end - ## - # Abbreviate the spec for downloading. Abbreviated specs are only used for - # searching, downloading and related activities and do not need deployment - # specific information (e.g. list of files). So we abbreviate the spec, - # making it much smaller for quicker downloads. - #-- - # TODO move to Gem::Specification - - def abbreviate(spec) - spec.files = [] - spec.test_files = [] - spec.rdoc_options = [] - spec.extra_rdoc_files = [] - spec.cert_chain = [] - spec - end - ## # Build various indicies @@ -221,18 +204,8 @@ class Gem::Indexer spec = Gem::Package.new(gemfile).spec spec.loaded_from = gemfile - # HACK: fuck this shit - borks all tests that use pl1 - # if File.basename(gemfile, ".gem") != spec.original_name then - # exp = spec.full_name - # exp << " (#{spec.original_name})" if - # spec.original_name != spec.full_name - # msg = "Skipping misnamed gem: #{gemfile} should be named #{exp}" - # alert_warning msg - # next - # end - - abbreviate spec - sanitize spec + spec.abbreviate + spec.sanitize spec rescue SignalException @@ -380,38 +353,6 @@ class Gem::Indexer end end - ## - # Sanitize the descriptive fields in the spec. Sometimes non-ASCII - # characters will garble the site index. Non-ASCII characters will - # be replaced by their XML entity equivalent. - - def sanitize(spec) - spec.summary = sanitize_string(spec.summary) - spec.description = sanitize_string(spec.description) - spec.post_install_message = sanitize_string(spec.post_install_message) - spec.authors = spec.authors.collect { |a| sanitize_string(a) } - - spec - end - - ## - # Sanitize a single string. - - def sanitize_string(string) - return string unless string - - # HACK the #to_s is in here because RSpec has an Array of Arrays of - # Strings for authors. Need a way to disallow bad values on gemspec - # generation. (Probably won't happen.) - string = string.to_s - - begin - Builder::XChar.encode string - rescue NameError, NoMethodError - string.to_xs - end - end - ## # Perform an in-place update of the repository from newly added gems. diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index 417b34b79f..e8b8b38b06 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -366,8 +366,9 @@ EOM FileUtils.mkdir_p mkdir, mkdir_options - open destination, 'wb', entry.header.mode do |out| + open destination, 'wb' do |out| out.write entry.read + FileUtils.chmod entry.header.mode, destination end if entry.file? verbose destination diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb index 819a1d8e2d..cfbc955ed9 100644 --- a/lib/rubygems/request_set.rb +++ b/lib/rubygems/request_set.rb @@ -223,7 +223,7 @@ class Gem::RequestSet if options.fetch :lock, true then lockfile = - Gem::RequestSet::Lockfile.new self, gemdeps, gem_deps_api.dependencies + Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies lockfile.write end @@ -275,7 +275,7 @@ class Gem::RequestSet @git_set.root_dir = @install_dir - lock_file = "#{File.expand_path(path)}.lock" + lock_file = "#{File.expand_path(path)}.lock".untaint begin tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file parser = tokenizer.make_parser self, [] diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb index 9aad5ab5d3..6dd7892b4c 100644 --- a/lib/rubygems/request_set/gem_dependency_api.rb +++ b/lib/rubygems/request_set/gem_dependency_api.rb @@ -367,11 +367,11 @@ class Gem::RequestSet::GemDependencyAPI @dependencies[name] = if requirements.empty? and not source_set then - nil + Gem::Requirement.default elsif source_set then - '!' + Gem::Requirement.source_set else - requirements + Gem::Requirement.create requirements end return unless gem_platforms options @@ -601,7 +601,7 @@ Gem dependencies file #{@path} requires #{name} more than once. add_dependencies groups, [self_dep] add_dependencies groups, spec.runtime_dependencies - @dependencies[spec.name] = '!' + @dependencies[spec.name] = Gem::Requirement.source_set spec.dependencies.each do |dep| @dependencies[dep.name] = dep.requirement diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb index 2c788fb703..3c54785aad 100644 --- a/lib/rubygems/request_set/lockfile.rb +++ b/lib/rubygems/request_set/lockfile.rb @@ -36,16 +36,41 @@ class Gem::RequestSet::Lockfile end end + ## + # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+ + # location. + + def self.build request_set, gem_deps_file, dependencies = nil + request_set.resolve + dependencies ||= requests_to_deps request_set.sorted_requests + new request_set, gem_deps_file, dependencies + end + + def self.requests_to_deps requests # :nodoc: + deps = {} + + requests.each do |request| + spec = request.spec + name = request.name + requirement = request.request.dependency.requirement + + deps[name] = if [Gem::Resolver::VendorSpecification, + Gem::Resolver::GitSpecification].include? spec.class then + Gem::Requirement.source_set + else + requirement + end + end + + deps + end + ## # The platforms for this Lockfile attr_reader :platforms - ## - # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+ - # location. - - def initialize request_set, gem_deps_file, dependencies = nil + def initialize request_set, gem_deps_file, dependencies @set = request_set @dependencies = dependencies @gem_deps_file = File.expand_path(gem_deps_file) @@ -59,41 +84,9 @@ class Gem::RequestSet::Lockfile def add_DEPENDENCIES out # :nodoc: out << "DEPENDENCIES" - dependencies = - if @dependencies then - @dependencies.sort_by { |name,| name }.map do |name, requirement| - requirement_string = - if '!' == requirement then - requirement - else - Gem::Requirement.new(requirement).for_lockfile - end - - [name, requirement_string] - end - else - requests.sort_by { |r| r.name }.map do |request| - spec = request.spec - name = request.name - requirement = request.request.dependency.requirement - - requirement_string = - if [Gem::Resolver::VendorSpecification, - Gem::Resolver::GitSpecification].include? spec.class then - "!" - else - requirement.for_lockfile - end - - [name, requirement_string] - end - end - - dependencies = dependencies.map do |name, requirement_string| - " #{name}#{requirement_string}" - end - - out.concat dependencies + out.concat @dependencies.sort_by { |name,| name }.map { |name, requirement| + " #{name}#{requirement.for_lockfile}" + } out << nil end @@ -207,8 +200,6 @@ class Gem::RequestSet::Lockfile # The contents of the lock file. def to_s - @set.resolve - out = [] groups = spec_groups diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb index bcf5fb967e..572bf9673e 100644 --- a/lib/rubygems/requirement.rb +++ b/lib/rubygems/requirement.rb @@ -23,6 +23,8 @@ class Gem::Requirement "~>" => lambda { |v, r| v >= r && v.release < r.bump } } + SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc: + quoted = OPS.keys.map { |k| Regexp.quote k }.join "|" PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc: @@ -54,6 +56,8 @@ class Gem::Requirement input when Gem::Version, Array then new input + when '!' then + source_set else if input.respond_to? :to_str then new [input.to_str] @@ -70,6 +74,13 @@ class Gem::Requirement new '>= 0' end + ### + # A source set requirement, used for Gemfiles and lockfiles + + def self.source_set # :nodoc: + SOURCE_SET_REQUIREMENT + end + ## # Parse +obj+, returning an [op, version] pair. +obj+ can # be a String or a Gem::Version. diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index eb89c4c97b..b73c563e2e 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -383,6 +383,8 @@ class Gem::Specification < Gem::BasicSpecification attr_reader :description ## + # :category: Recommended gemspec attributes + # # A contact email address (or addresses) for this gem # # Usage: @@ -393,11 +395,13 @@ class Gem::Specification < Gem::BasicSpecification attr_accessor :email ## + # :category: Recommended gemspec attributes + # # The URL of this gem's home page # # Usage: # - # spec.homepage = 'http://rake.rubyforge.org' + # spec.homepage = 'https://github.com/ruby/rake' attr_accessor :homepage @@ -1321,6 +1325,50 @@ class Gem::Specification < Gem::BasicSpecification unresolved.delete self.name end + ## + # Abbreviate the spec for downloading. Abbreviated specs are only used for + # searching, downloading and related activities and do not need deployment + # specific information (e.g. list of files). So we abbreviate the spec, + # making it much smaller for quicker downloads. + + def abbreviate + self.files = [] + self.test_files = [] + self.rdoc_options = [] + self.extra_rdoc_files = [] + self.cert_chain = [] + end + + ## + # Sanitize the descriptive fields in the spec. Sometimes non-ASCII + # characters will garble the site index. Non-ASCII characters will + # be replaced by their XML entity equivalent. + + def sanitize + self.summary = sanitize_string(summary) + self.description = sanitize_string(description) + self.post_install_message = sanitize_string(post_install_message) + self.authors = authors.collect { |a| sanitize_string(a) } + end + + ## + # Sanitize a single string. + + def sanitize_string(string) + return string unless string + + # HACK the #to_s is in here because RSpec has an Array of Arrays of + # Strings for authors. Need a way to disallow bad values on gemspec + # generation. (Probably won't happen.) + string = string.to_s + + begin + Builder::XChar.encode string + rescue NameError, NoMethodError + string.to_xs + end + end + ## # Returns an array with bindir attached to each executable in the # +executables+ list @@ -2609,7 +2657,7 @@ http://opensource.org/licenses/alphabetical # Warnings - %w[author description email homepage summary].each do |attribute| + %w[author email homepage summary].each do |attribute| value = self.send attribute warning "no #{attribute} specified" if value.nil? or value.empty? end diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index cb2e2b8be7..6d015176e3 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -1426,6 +1426,21 @@ Also, a list: end +# require dependencies that are not discoverable once GEM_HOME and GEM_PATH +# are wiped +begin + gem 'rake' +rescue Gem::LoadError +end + +require 'rake/packagetask' + +begin + gem 'rdoc' + require 'rdoc' +rescue LoadError, Gem::LoadError +end + require 'rubygems/test_utilities' ENV['GEM_HOME'] = Dir.mktmpdir "home" ENV['GEM_PATH'] = Dir.mktmpdir "path" diff --git a/lib/rubygems/text.rb b/lib/rubygems/text.rb index 5c9287ad2e..4c033cf00e 100644 --- a/lib/rubygems/text.rb +++ b/lib/rubygems/text.rb @@ -43,11 +43,9 @@ module Gem::Text t = str2 n = s.length m = t.length - max = n/2 return m if (0 == n) return n if (0 == m) - return n if (n - m).abs > max d = (0..m).to_a x = nil diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index 8335ebe182..c581aa367f 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -217,12 +217,14 @@ class Gem::Version # Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored. def bump - segments = self.segments.dup - segments.pop while segments.any? { |s| String === s } - segments.pop if segments.size > 1 + @bump ||= begin + segments = self.segments.dup + segments.pop while segments.any? { |s| String === s } + segments.pop if segments.size > 1 - segments[-1] = segments[-1].succ - self.class.new segments.join(".") + segments[-1] = segments[-1].succ + self.class.new segments.join(".") + end end ## @@ -291,11 +293,13 @@ class Gem::Version # Non-prerelease versions return themselves. def release - return self unless prerelease? - - segments = self.segments.dup - segments.pop while segments.any? { |s| String === s } - self.class.new segments.join('.') + @release ||= if prerelease? + segments = self.segments.dup + segments.pop while segments.any? { |s| String === s } + self.class.new segments.join('.') + else + self + end end def segments # :nodoc: diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index 38e00bb1cc..ec5f3ad186 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -225,6 +225,28 @@ class TestGemCommandsPristineCommand < Gem::TestCase assert_empty out, out.inspect end + def test_skip + a = util_spec 'a' + b = util_spec 'b' + + install_gem a + install_gem b + + @cmd.options[:args] = %w[a b] + @cmd.options[:skip] = 'a' + + use_ui @ui do + @cmd.execute + end + + out = @ui.output.split "\n" + + assert_equal "Restoring gems to pristine condition...", out.shift + assert_equal "Skipped #{a.full_name}, it was given through options", out.shift + assert_equal "Restored #{b.full_name}", out.shift + assert_empty out, out.inspect + end + def test_execute_many_multi_repo a = util_spec 'a' install_gem a 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 32c03bacf6..5d7f2d1296 100644 --- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb +++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb @@ -88,7 +88,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[a], @gda.requires['a'] - expected = { 'a' => nil } + expected = { 'a' => Gem::Requirement.default } assert_equal expected, @gda.dependencies end @@ -112,7 +112,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[git/a master], @git_set.repositories['a'] - expected = { 'a' => '!' } + expected = { 'a' => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -125,7 +125,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[https://example@bitbucket.org/example/repository.git master], @git_set.repositories['a'] - expected = { 'a' => '!' } + expected = { 'a' => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -138,7 +138,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[https://example@bitbucket.org/example/example.git master], @git_set.repositories['a'] - expected = { 'a' => '!' } + expected = { 'a' => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -193,7 +193,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[git://github.com/example/repository.git master], @git_set.repositories['a'] - expected = { 'a' => '!' } + expected = { 'a' => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -206,7 +206,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[git://github.com/example/example.git master], @git_set.repositories['a'] - expected = { 'a' => '!' } + expected = { 'a' => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -224,7 +224,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_empty @set.dependencies - expected = { 'a' => nil } + expected = { 'a' => Gem::Requirement.default } assert_equal expected, @gda.dependencies end @@ -246,7 +246,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal "#{name}-#{version}", loaded.full_name - expected = { name => '!' } + expected = { name => Gem::Requirement.create('!') } assert_equal expected, @gda.dependencies end @@ -405,7 +405,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal [dep('a', '~> 1.0')], @set.dependencies - expected = { 'a' => ['~> 1.0'] } + expected = { 'a' => Gem::Requirement.create(['~> 1.0']) } assert_equal expected, @gda.dependencies end @@ -415,7 +415,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies - expected = { 'b' => ['~> 1.0', '>= 1.0.2'] } + expected = { 'b' => Gem::Requirement.create(['~> 1.0', '>= 1.0.2']) } assert_equal expected, @gda.dependencies end @@ -485,7 +485,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase assert_equal %w[a], @gda.requires['a'] expected = { - 'a' => '!', + 'a' => Gem::Requirement.create('!'), 'b' => req('= 2'), 'c' => req('= 3'), } diff --git a/test/rubygems/test_gem_request_set_lockfile.rb b/test/rubygems/test_gem_request_set_lockfile.rb index f825a8b359..6d5b4de581 100644 --- a/test/rubygems/test_gem_request_set_lockfile.rb +++ b/test/rubygems/test_gem_request_set_lockfile.rb @@ -21,7 +21,10 @@ class TestGemRequestSetLockfile < Gem::TestCase @gem_deps_file = 'gem.deps.rb' - @lockfile = Gem::RequestSet::Lockfile.new @set, @gem_deps_file + end + + def lockfile + Gem::RequestSet::Lockfile.build @set, @gem_deps_file end def write_lockfile lockfile @@ -44,7 +47,7 @@ class TestGemRequestSetLockfile < Gem::TestCase out = [] - @lockfile.add_DEPENDENCIES out + lockfile.add_DEPENDENCIES out expected = [ 'DEPENDENCIES', @@ -62,7 +65,7 @@ class TestGemRequestSetLockfile < Gem::TestCase end end - dependencies = { 'a' => '~> 2.0' } + dependencies = { 'a' => Gem::Requirement.new('~> 2.0') } @set.gem 'a' @set.resolve @@ -100,7 +103,7 @@ class TestGemRequestSetLockfile < Gem::TestCase out = [] - @lockfile.add_GEM out, @lockfile.spec_groups + lockfile.add_GEM out, lockfile.spec_groups expected = [ 'GEM', @@ -131,7 +134,7 @@ class TestGemRequestSetLockfile < Gem::TestCase out = [] - @lockfile.add_PLATFORMS out + lockfile.add_PLATFORMS out expected = [ 'PLATFORMS', @@ -144,11 +147,11 @@ class TestGemRequestSetLockfile < Gem::TestCase end def test_relative_path_from - path = @lockfile.relative_path_from '/foo', '/foo/bar' + path = lockfile.relative_path_from '/foo', '/foo/bar' assert_equal File.expand_path('/foo'), path - path = @lockfile.relative_path_from '/foo', '/foo' + path = lockfile.relative_path_from '/foo', '/foo' assert_equal '.', path end @@ -173,7 +176,7 @@ DEPENDENCIES a LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_dependency @@ -204,7 +207,7 @@ DEPENDENCIES c LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_dependency_non_default @@ -232,7 +235,7 @@ DEPENDENCIES b LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_dependency_requirement @@ -259,7 +262,7 @@ DEPENDENCIES b LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_path @@ -282,7 +285,7 @@ DEPENDENCIES a! LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_path_absolute @@ -305,7 +308,7 @@ DEPENDENCIES a! LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_platform @@ -330,7 +333,7 @@ DEPENDENCIES a LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_gem_source @@ -368,7 +371,7 @@ DEPENDENCIES b LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_to_s_git @@ -435,11 +438,11 @@ DEPENDENCIES c! LOCKFILE - assert_equal expected, @lockfile.to_s + assert_equal expected, lockfile.to_s end def test_write - @lockfile.write + lockfile.write gem_deps_lock_file = "#{@gem_deps_file}.lock" @@ -458,7 +461,7 @@ DEPENDENCIES end assert_raises Gem::UnsatisfiableDependencyError do - @lockfile.write + lockfile.write end assert_path_exists gem_deps_lock_file diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 020cfb2ae6..27650837be 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -2413,8 +2413,6 @@ duplicate dependency on b (>= 1.2.3), (~> 1.2) use: @a1.validate end - assert_match "#{w}: no description specified\n", @ui.error, "error" - @ui = Gem::MockGemUi.new @a1.summary = "this is my summary" @a1.description = @a1.summary diff --git a/test/rubygems/test_gem_text.rb b/test/rubygems/test_gem_text.rb index e5cfc41e61..90f81fcd51 100644 --- a/test/rubygems/test_gem_text.rb +++ b/test/rubygems/test_gem_text.rb @@ -64,6 +64,8 @@ Without the wrapping, the text might not look good in the RSS feed. def test_levenshtein_distance_remove assert_equal 3, levenshtein_distance("zentest", "zentestxxx") assert_equal 3, levenshtein_distance("zentestxxx", "zentest") + assert_equal 13, levenshtein_distance("cat", "thundercatsarego") + assert_equal 13, levenshtein_distance("thundercatsarego", "cat") end def test_levenshtein_distance_replace