summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_source_specific_file.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-26 20:24:51 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-26 20:24:51 +0000
commite487a7f53cffbadf0bf15ff169c9cb5898503250 (patch)
treeeaa80eb4ced6fcdcc8b327d1cc5e47f66703fd1b /test/rubygems/test_gem_source_specific_file.rb
parentcddd93a57568966b416e300529bdffc0c7e87b51 (diff)
* lib/rubygems: Import RubyGems 2.1.0 Release Candidate
* test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_source_specific_file.rb')
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_source_specific_file.rb b/test/rubygems/test_gem_source_specific_file.rb
index 1d83517..8ccbe50 100644
--- a/test/rubygems/test_gem_source_specific_file.rb
+++ b/test/rubygems/test_gem_source_specific_file.rb
@@ -30,4 +30,42 @@ class TestGemSourceSpecificFile < Gem::TestCase
def test_download
assert_equal @a_gem, @sf.download(@a)
end
+
+ def test_spaceship
+ a1 = quick_gem 'a', '1'
+ util_build_gem a1
+
+ remote = Gem::Source.new @gem_repo
+ specific = Gem::Source::SpecificFile.new a1.cache_file
+ installed = Gem::Source::Installed.new
+ local = Gem::Source::Local.new
+
+ assert_equal( 0, specific. <=>(specific), 'specific <=> specific')
+
+ assert_equal(-1, remote. <=>(specific), 'remote <=> specific')
+ assert_equal( 1, specific. <=>(remote), 'specific <=> remote')
+
+ assert_equal(-1, specific. <=>(local), 'specific <=> local')
+ assert_equal( 1, local. <=>(specific), 'local <=> specific')
+
+ assert_equal(-1, specific. <=>(installed), 'specific <=> installed')
+ assert_equal( 1, installed.<=>(specific), 'installed <=> specific')
+
+ a2 = quick_gem 'a', '2'
+ util_build_gem a2
+
+ b1 = quick_gem 'b', '1'
+ util_build_gem b1
+
+ a1_source = specific
+ a2_source = Gem::Source::SpecificFile.new a2.cache_file
+ b1_source = Gem::Source::SpecificFile.new b1.cache_file
+
+ assert_nil a1_source.<=>(b1_source), 'a1_source <=> b1_source'
+
+ assert_equal(-1, a1_source.<=>(a2_source), 'a1_source <=> a2_source')
+ assert_equal( 0, a1_source.<=>(a1_source), 'a1_source <=> a1_source')
+ assert_equal( 1, a2_source.<=>(a1_source), 'a2_source <=> a1_source')
+ end
+
end