summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-09-26 11:35:02 +0200
committergit <svn-admin@ruby-lang.org>2024-09-30 05:07:57 +0000
commit73d60df6e015d20b418d6307965251cbaec18e68 (patch)
tree2358c870be3c7a9d7443e44e2be78e666a937f5c /test
parent1b6c234fec2addd74a4fe2349edd853adde91df8 (diff)
[rubygems/rubygems] Don't list duplicated version in `Gem::Specification.reset` warning
https://github.com/rubygems/rubygems/commit/e6e3db821f
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_specification.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 0a009cbd7b..d434ea96f3 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -3087,6 +3087,40 @@ Please report a bug if this causes problems.
assert_equal(expected, actual_stderr)
end
+ def test_unresolved_specs_with_duplicated_versions
+ specification = Gem::Specification.clone
+
+ set_orig specification
+
+ specification.define_singleton_method(:unresolved_deps) do
+ { b: Gem::Dependency.new("x","1") }
+ end
+
+ specification.define_singleton_method(:find_all_by_name) do |_dep_name|
+ [
+ specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") }, # default copy
+ specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") }, # regular copy
+ specification.new {|s| s.name = "z", s.version = Gem::Version.new("2") }, # regular copy
+ ]
+ end
+
+ expected = <<-EXPECTED
+WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
+ x (= 1)
+ Available/installed versions of this gem:
+ - 1
+ - 2
+WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
+Please report a bug if this causes problems.
+ EXPECTED
+
+ actual_stdout, actual_stderr = capture_output do
+ specification.reset
+ end
+ assert_empty actual_stdout
+ assert_equal(expected, actual_stderr)
+ end
+
def test_duplicate_runtime_dependency
expected = "WARNING: duplicated b dependency [\"~> 3.0\", \"~> 3.0\"]\n"
out, err = capture_output do