Sha256: a085ed70d1549d427ba82e9af085addb07945a1b3ca3c36ce672645418204d9c

Contents?: true

Size: 1.81 KB

Versions: 26

Compression:

Stored size: 1.81 KB

Contents

# 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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rubygems-update-3.2.24 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.23 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.22 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.21 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.20 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.19 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.18 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.17 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.16 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.15 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.14 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.13 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.12 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.11 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.10 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.9 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.8 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.7 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.6 test/rubygems/test_gem_impossible_dependencies_error.rb
rubygems-update-3.2.5 test/rubygems/test_gem_impossible_dependencies_error.rb