summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_source_specific_file.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-14 08:59:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-14 08:59:02 +0000
commit269503b544247b5b3e30dbe60a0bab4f2ca00e4e (patch)
treea6d0a3a9b34017c4c84d997152a3aaf3086e1ce1 /test/rubygems/test_gem_source_specific_file.rb
parent2614d9ba2fb5ad171200cccc88f42fa659b527c6 (diff)
Revert r42938 "* lib/rubygems: Update to RubyGems 2.1.3"
It breaks build. http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20130913T200302Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42941 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.rb40
1 files changed, 39 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_source_specific_file.rb b/test/rubygems/test_gem_source_specific_file.rb
index 7ffcf48..8ccbe50 100644
--- a/test/rubygems/test_gem_source_specific_file.rb
+++ b/test/rubygems/test_gem_source_specific_file.rb
@@ -1,5 +1,5 @@
require 'rubygems/test_case'
-require 'rubygems/source_specific_file'
+require 'rubygems/source/specific_file'
class TestGemSourceSpecificFile < Gem::TestCase
def setup
@@ -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