aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_sources_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_sources_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 8b439025ed..6bae460c84 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -99,6 +99,25 @@ Error fetching http://beta-gems.example.com:
assert_equal '', @ui.error
end
+ def test_execute_add_redundant_source
+ @cmd.handle_options %W[--add #{@gem_repo}]
+
+ util_setup_spec_fetcher
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal [@gem_repo], Gem.sources
+
+ expected = <<-EOF
+source #{@gem_repo} already present in the cache
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_add_bad_uri
@cmd.handle_options %w[--add beta-gems.example.com]
@@ -125,11 +144,6 @@ beta-gems.example.com is not a URI
util_setup_spec_fetcher
- fetcher = Gem::SpecFetcher.fetcher
-
- # HACK figure out how to force directory creation via fetcher
- #assert File.directory?(fetcher.dir), 'cache dir exists'
-
use_ui @ui do
@cmd.execute
end
@@ -141,7 +155,8 @@ beta-gems.example.com is not a URI
assert_equal expected, @ui.output
assert_equal '', @ui.error
- refute File.exist?(fetcher.dir), 'cache dir removed'
+ dir = File.join Gem.user_home, '.gem', 'specs'
+ refute File.exist?(dir), 'cache dir removed'
end
def test_execute_remove