2013-07-09 19:21:36 -04:00
|
|
|
require 'rubygems/test_case'
|
|
|
|
|
|
|
|
class TestGemImpossibleDependenciesError < Gem::TestCase
|
|
|
|
|
|
|
|
def test_message_conflict
|
|
|
|
request = dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
|
|
|
|
|
|
|
|
conflicts = []
|
|
|
|
|
|
|
|
# These conflicts are lies as their dependencies does not have the correct
|
|
|
|
# requested-by entries, but they are suitable for testing the message.
|
|
|
|
# See #485 to construct a correct conflict.
|
|
|
|
net_ssh_2_2_2 =
|
|
|
|
dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', request
|
|
|
|
net_ssh_2_6_5 =
|
|
|
|
dependency_request dep('net-ssh', '~> 2.2.2'), 'net-ssh', '2.6.5', request
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
conflict1 = Gem::Resolver::Conflict.new \
|
2013-07-09 19:21:36 -04:00
|
|
|
net_ssh_2_6_5, net_ssh_2_6_5.requester
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
conflict2 = Gem::Resolver::Conflict.new \
|
2013-07-09 19:21:36 -04:00
|
|
|
net_ssh_2_2_2, net_ssh_2_2_2.requester
|
|
|
|
|
|
|
|
conflicts << [net_ssh_2_6_5.requester.spec, conflict1]
|
|
|
|
conflicts << [net_ssh_2_2_2.requester.spec, conflict2]
|
|
|
|
|
|
|
|
error = Gem::ImpossibleDependenciesError.new request, conflicts
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
rye-0.9.8 requires net-ssh (>= 2.0.13) but it conflicted:
|
2013-11-21 18:27:30 -05:00
|
|
|
Activated net-ssh-2.6.5 via:
|
|
|
|
net-ssh-2.6.5 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
|
|
|
|
instead of (~> 2.2.2) via:
|
|
|
|
net-ssh-2.6.5 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
|
|
|
|
Activated net-ssh-2.2.2 via:
|
|
|
|
net-ssh-2.2.2 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
|
|
|
|
instead of (>= 2.6.5) via:
|
|
|
|
net-ssh-2.2.2 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
|
2013-07-09 19:21:36 -04:00
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, error.message
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|