summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_dependency_resolver_dependency_conflict.rb
blob: 56a34d300141d2ec71549fde7e03d645a9237fb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'rubygems/test_case'
require 'rubygems/dependency_resolver'

class TestGemDependencyResolverDependencyConflict < Gem::TestCase

  def test_explanation
    root  =
      dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
    child = 
      dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', root

    conflict =
      Gem::DependencyResolver::DependencyConflict.new child, child.requester

    expected = <<-EXPECTED
  Activated net-ssh-2.2.2 instead of (>= 2.6.5) via:
    net-ssh-2.2.2, rye-0.9.8
    EXPECTED

    assert_equal expected, conflict.explanation
  end

  def test_request_path
    root  =
      dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
    child = 
      dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', root

    conflict =
      Gem::DependencyResolver::DependencyConflict.new child, nil

    assert_equal %w[net-ssh-2.2.2 rye-0.9.8], conflict.request_path
  end

end