summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_local_remote_options.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-19 00:08:49 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-19 00:08:49 +0000
commite798ccbacf489a3af2201ae30058ff0ae7f79045 (patch)
tree4147a7834eb88323057fd2120a2ddc96c1eb32ab /test/rubygems/test_gem_local_remote_options.rb
parentd26fb035cae8d351dc238376722c980230dc5fbd (diff)
Import rubygems 1.5.0 (release candidate)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_local_remote_options.rb')
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb27
1 files changed, 25 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_local_remote_options.rb b/test/rubygems/test_gem_local_remote_options.rb
index 05083f5d07..7f122d29a6 100644
--- a/test/rubygems/test_gem_local_remote_options.rb
+++ b/test/rubygems/test_gem_local_remote_options.rb
@@ -1,4 +1,10 @@
-require_relative 'gemutilities'
+######################################################################
+# This file is imported from the rubygems project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis or Eric Hodel.
+######################################################################
+
+require "test/rubygems/gemutilities"
require 'rubygems/local_remote_options'
require 'rubygems/command'
@@ -30,6 +36,21 @@ class TestGemLocalRemoteOptions < RubyGemTestCase
assert_equal true, @cmd.both?
end
+ def test_clear_sources_option
+ @cmd.add_local_remote_options
+
+ s = URI.parse "http://only-gems.example.com/"
+
+ @cmd.handle_options %W[--clear-sources --source #{s}]
+ assert_equal [s.to_s], Gem.sources
+ end
+
+ def test_clear_sources_option_idiot_proof
+ @cmd.add_local_remote_options
+ @cmd.handle_options %W[--clear-sources]
+ assert_equal Gem.default_sources, Gem.sources
+ end
+
def test_local_eh
assert_equal false, @cmd.local?
@@ -62,9 +83,11 @@ class TestGemLocalRemoteOptions < RubyGemTestCase
s3 = URI.parse 'http://other-gems.example.com/some_subdir'
s4 = URI.parse 'http://more-gems.example.com/' # Intentional duplicate
+ original_sources = Gem.sources.dup
@cmd.handle_options %W[--source #{s1} --source #{s2} --source #{s3} --source #{s4}]
- assert_equal [s1.to_s, s2.to_s, "#{s3}/"], Gem.sources
+ assert_equal [original_sources, s1.to_s, s2.to_s, "#{s3}/"].flatten,
+ Gem.sources
end
def test_update_sources_option