2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2021-06-01 23:32:47 -04:00
|
|
|
require_relative "helper"
|
2013-11-10 12:51:40 -05:00
|
|
|
require "rubygems/source"
|
|
|
|
|
|
|
|
class TestGemSourceVendor < Gem::TestCase
|
|
|
|
def test_initialize
|
|
|
|
source = Gem::Source::Vendor.new "vendor/foo"
|
|
|
|
|
|
|
|
assert_equal "vendor/foo", source.uri
|
|
|
|
end
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
def test_spaceship
|
|
|
|
vendor = Gem::Source::Vendor.new "vendor/foo"
|
|
|
|
remote = Gem::Source.new @gem_repo
|
2014-09-13 23:30:02 -04:00
|
|
|
git = Gem::Source::Git.new "a", "a", "master"
|
2013-11-18 19:34:13 -05:00
|
|
|
installed = Gem::Source::Installed.new
|
|
|
|
|
2020-03-27 08:49:55 -04:00
|
|
|
assert_equal(0, vendor.<=>(vendor), "vendor <=> vendor")
|
2013-11-18 19:34:13 -05:00
|
|
|
|
2020-03-27 08:49:55 -04:00
|
|
|
assert_equal(1, vendor.<=>(remote), "vendor <=> remote")
|
2019-05-03 13:56:58 -04:00
|
|
|
assert_equal(-1, remote.<=>(vendor), "remote <=> vendor")
|
2013-11-18 19:34:13 -05:00
|
|
|
|
2019-05-03 13:56:58 -04:00
|
|
|
assert_equal(1, vendor.<=>(git), "vendor <=> git")
|
|
|
|
assert_equal(-1, git.<=>(vendor), "git <=> vendor")
|
2014-09-13 23:30:02 -04:00
|
|
|
|
2020-03-27 08:49:55 -04:00
|
|
|
assert_equal(1, vendor.<=>(installed), "vendor <=> installed")
|
2019-05-03 13:56:58 -04:00
|
|
|
assert_equal(-1, installed.<=>(vendor), "installed <=> vendor")
|
2013-11-18 19:34:13 -05:00
|
|
|
end
|
2013-11-10 12:51:40 -05:00
|
|
|
end
|