aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_sources_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-01 11:40:46 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-01 11:40:46 +0000
commit08c162e55b6b1e4929ea2042be98f5427e928e4e (patch)
treed2c623b0217bdd93ce8d3b9471b2235b36588bf2 /test/rubygems/test_gem_commands_sources_command.rb
parent2fdfd74830ddb9e07b201d1c07657e3c03c7aa89 (diff)
downloadruby-08c162e55b6b1e4929ea2042be98f5427e928e4e.tar.gz
Merge rubygems-2.6.12 from rubygems/rubygems.
* Details of changes: https://github.com/rubygems/rubygems/blob/009080040279282d7b8ddd09acab41719cb4ba00/History.txt#L3 * I kept ko1's commmit related thread issue. It's not merged 2.6 branch on rubygems. https://github.com/ruby/ruby/commit/1721dfa0ea963a85d4ac1e3415eb18ef427d4d36 * I removed test_realworld_default_gem from rubygems-2.6.12. It fails on Ruby trunk. Because it's differences of test suite and environment. https://github.com/rubygems/rubygems/pull/1899 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_sources_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 014b4b4c12..d5b6d99419 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -108,6 +108,58 @@ source #{@gem_repo} already present in the cache
assert_equal '', @ui.error
end
+ def test_execute_add_redundant_source_trailing_slash
+ # Remove pre-existing gem source (w/ slash)
+ repo_with_slash = "http://gems.example.com/"
+ @cmd.handle_options %W[--remove #{repo_with_slash}]
+ use_ui @ui do
+ @cmd.execute
+ end
+ source = Gem::Source.new repo_with_slash
+ assert_equal false, Gem.sources.include?(source)
+
+ expected = <<-EOF
+#{repo_with_slash} removed from sources
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+
+ # Re-add pre-existing gem source (w/o slash)
+ repo_without_slash = "http://gems.example.com"
+ @cmd.handle_options %W[--add #{repo_without_slash}]
+ use_ui @ui do
+ @cmd.execute
+ end
+ source = Gem::Source.new repo_without_slash
+ assert_equal true, Gem.sources.include?(source)
+
+ expected = <<-EOF
+http://gems.example.com/ removed from sources
+http://gems.example.com added to sources
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+
+ # Re-add original gem source (w/ slash)
+ @cmd.handle_options %W[--add #{repo_with_slash}]
+ use_ui @ui do
+ @cmd.execute
+ end
+ source = Gem::Source.new repo_with_slash
+ assert_equal true, Gem.sources.include?(source)
+
+ expected = <<-EOF
+http://gems.example.com/ removed from sources
+http://gems.example.com added to sources
+source http://gems.example.com/ already present in the cache
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_add_http_rubygems_org
http_rubygems_org = 'http://rubygems.org'