Browse files

Fix test-only UnsatisfiablyDependencyError bug

It seems this bug only exists for the test that checks it directly.
Presumably "real" use always has a requester.

Remove '' from messaging because I don't like them
  • Loading branch information...
1 parent aaebba9 commit 6faa92ca4a6470538cfc4a648abfbb45542bbb16 @drbrain drbrain committed Apr 3, 2013
View
6 lib/rubygems/dependency_resolver.rb
@@ -31,7 +31,9 @@ def conflicting_dependencies
class UnsatisfiableDependencyError < Gem::Exception
def initialize(dep)
- super "Unable to resolve dependency: '#{dep.requester.request}' requires '#{dep}'"
+ requester = dep.requester ? dep.requester.request : '(unknown)'
+
+ super "Unable to resolve dependency: #{requester} requires #{dep}"
@dependency = dep
end
@@ -50,7 +52,7 @@ def initialize(dep)
class ImpossibleDependenciesError < Gem::Exception
def initialize(request, conflicts)
s = conflicts.size == 1 ? "" : "s"
- super "detected #{conflicts.size} conflict#{s} with dependency '#{request.dependency}'"
+ super "detected #{conflicts.size} conflict#{s} with dependency #{request.dependency}"
@request = request
@conflicts = conflicts
end
View
2 test/rubygems/test_gem_dependency_installer.rb
@@ -646,7 +646,7 @@ def test_install_domain_local
inst.install 'b'
end
- expected = "Unable to resolve dependency: 'b (= 1)' requires 'a (>= 0)'"
+ expected = "Unable to resolve dependency: b (= 1) requires a (>= 0)"
assert_equal expected, e.message
end
View
5 test/rubygems/test_gem_dependency_resolver.rb
@@ -177,7 +177,8 @@ def test_raises_when_a_gem_is_missing
r.resolve
end
- assert_equal "unable to find any gem matching dependency 'a (>= 0)'", e.message
+ assert_equal "Unable to resolve dependency: (unknown) requires a (>= 0)",
+ e.message
assert_equal "a (>= 0)", e.dependency.to_s
end
@@ -215,7 +216,7 @@ def test_raises_when_possibles_are_exhausted
r.resolve
end
- assert_equal "detected 1 conflict with dependency 'c (>= 2)'", e.message
+ assert_equal "detected 1 conflict with dependency c (>= 2)", e.message
assert_equal "c (>= 2)", e.dependency.to_s

0 comments on commit 6faa92c

Please sign in to comment.