2013-09-09 20:52:14 -04:00
|
|
|
require 'rubygems/test_case'
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
class TestGemResolverInstallerSet < Gem::TestCase
|
2013-09-09 20:52:14 -04:00
|
|
|
|
2014-02-03 19:48:31 -05:00
|
|
|
def test_consider_local_eh
|
|
|
|
set = Gem::Resolver::InstallerSet.new :remote
|
|
|
|
|
|
|
|
refute set.consider_local?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :both
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :local
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_consider_remote_eh
|
|
|
|
set = Gem::Resolver::InstallerSet.new :remote
|
|
|
|
|
|
|
|
assert set.consider_remote?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :both
|
|
|
|
|
|
|
|
assert set.consider_remote?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :local
|
|
|
|
|
|
|
|
refute set.consider_remote?
|
|
|
|
end
|
|
|
|
|
2013-09-09 20:52:14 -04:00
|
|
|
def test_load_spec
|
2013-11-11 19:16:41 -05:00
|
|
|
specs = spec_fetcher do |fetcher|
|
2013-11-10 12:51:40 -05:00
|
|
|
fetcher.spec 'a', 2
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
|
2013-11-10 12:51:40 -05:00
|
|
|
end
|
2013-09-09 20:52:14 -04:00
|
|
|
|
|
|
|
source = Gem::Source.new @gem_repo
|
|
|
|
version = v 2
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
set = Gem::Resolver::InstallerSet.new :remote
|
2013-09-09 20:52:14 -04:00
|
|
|
|
|
|
|
spec = set.load_spec 'a', version, Gem::Platform.local, source
|
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
assert_equal specs["a-2-#{Gem::Platform.local}"].full_name, spec.full_name
|
2013-09-09 20:52:14 -04:00
|
|
|
end
|
|
|
|
|
2014-02-03 19:48:31 -05:00
|
|
|
def test_remote_equals_both
|
|
|
|
set = Gem::Resolver::InstallerSet.new :both
|
|
|
|
set.remote = true
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
assert set.consider_remote?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :both
|
|
|
|
set.remote = false
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
refute set.consider_remote?
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_remote_equals_local
|
|
|
|
set = Gem::Resolver::InstallerSet.new :local
|
|
|
|
set.remote = true
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
assert set.consider_remote?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :local
|
|
|
|
set.remote = false
|
|
|
|
|
|
|
|
assert set.consider_local?
|
|
|
|
refute set.consider_remote?
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_remote_equals_remote
|
|
|
|
set = Gem::Resolver::InstallerSet.new :remote
|
|
|
|
set.remote = true
|
|
|
|
|
|
|
|
refute set.consider_local?
|
|
|
|
assert set.consider_remote?
|
|
|
|
|
|
|
|
set = Gem::Resolver::InstallerSet.new :remote
|
|
|
|
set.remote = false
|
|
|
|
|
|
|
|
refute set.consider_local?
|
|
|
|
refute set.consider_remote?
|
|
|
|
end
|
|
|
|
|
2013-09-09 20:52:14 -04:00
|
|
|
end
|
|
|
|
|