1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems/test_gem_impossible_dependencies_error.rb
hsbt 5335ce0e06 Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop
    https://github.com/rubygems/rubygems/pull/2478
  * Enable Style/MultilineIfThen in Rubocop
    https://github.com/rubygems/rubygems/pull/2479
  * Fix required_ruby_version with prereleases and improve error message
    https://github.com/rubygems/rubygems/pull/2344
  * Fix bundler rubygems binstub not properly looking for bundler
    https://github.com/rubygems/rubygems/pull/2426

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-21 10:20:47 +00:00

61 lines
1.8 KiB
Ruby

# frozen_string_literal: true
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
conflict1 = Gem::Resolver::Conflict.new \
net_ssh_2_6_5, net_ssh_2_6_5.requester
conflict2 = Gem::Resolver::Conflict.new \
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:
Activated net-ssh-2.6.5
which does not match conflicting dependency (~> 2.2.2)
Conflicting dependency chains:
rye (= 0.9.8), 0.9.8 activated, depends on
net-ssh (>= 2.0.13), 2.6.5 activated
versus:
rye (= 0.9.8), 0.9.8 activated, depends on
net-ssh (>= 2.0.13), 2.6.5 activated, depends on
net-ssh (~> 2.2.2)
Activated net-ssh-2.2.2
which does not match conflicting dependency (>= 2.6.5)
Conflicting dependency chains:
rye (= 0.9.8), 0.9.8 activated, depends on
net-ssh (>= 2.0.13), 2.2.2 activated
versus:
rye (= 0.9.8), 0.9.8 activated, depends on
net-ssh (>= 2.0.13), 2.2.2 activated, depends on
net-ssh (>= 2.6.5)
EXPECTED
assert_equal expected, error.message
end
end