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_resolver_conflict.rb
drbrain 5307d803f5 * lib/rubygems: Update to RubyGems master 50a8210. Important changes
in this commit:

  RubyGems now automatically checks for gem.deps.rb or Gemfile when
  running ruby executables.  This behavior is similar to `bundle exec
  rake`.  This change may be reverted before Ruby 2.1.0 if too many bugs
  are found.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 23:27:30 +00:00

75 lines
1.8 KiB
Ruby

require 'rubygems/test_case'
class TestGemResolverConflict < Gem::TestCase
def test_self_compatibility
assert_same Gem::Resolver::Conflict, Gem::Resolver::DependencyConflict
end
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
dep = Gem::Resolver::DependencyRequest.new dep('net-ssh', '>= 2.0.13'), nil
spec = quick_spec 'net-ssh', '2.2.2'
active =
Gem::Resolver::ActivationRequest.new spec, dep
conflict =
Gem::Resolver::Conflict.new child, active
expected = <<-EXPECTED
Activated net-ssh-2.2.2 via:
net-ssh-2.2.2 (>= 2.0.13)
instead of (>= 2.6.5) via:
net-ssh-2.2.2 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
EXPECTED
assert_equal expected, conflict.explanation
end
def test_explanation_user_request
@DR = Gem::Resolver
spec = util_spec 'a', 2
a1_req = @DR::DependencyRequest.new dep('a', '= 1'), nil
a2_req = @DR::DependencyRequest.new dep('a', '= 2'), nil
activated = @DR::ActivationRequest.new spec, a2_req
conflict = @DR::Conflict.new a1_req, activated
expected = <<-EXPECTED
Activated a-2 via:
a-2 (= 2)
instead of (= 1) via:
user request (gem command or Gemfile)
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('other', '>= 1.0'), 'net-ssh', '2.2.2', root
conflict =
Gem::Resolver::Conflict.new nil, nil
expected = [
'net-ssh-2.2.2 (>= 2.0.13)',
'rye-0.9.8 (= 0.9.8)'
]
assert_equal expected, conflict.request_path(child.requester)
end
end