summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_generate_index_command.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-13 20:19:08 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-13 20:19:33 +0900
commit82cc2843a92b286cc13afd0860a4e111d4ea2a0b (patch)
treea517dedd40d35540930cea7732f5a36e76a549e8 /test/rubygems/test_gem_commands_generate_index_command.rb
parent26774351dc5f494253ba031e4bc453dc4dddb2cf (diff)
Prepare to release RubyGems 3.1.0 final version.
Diffstat (limited to 'test/rubygems/test_gem_commands_generate_index_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb
index b4276702f4..d8fda32fc0 100644
--- a/test/rubygems/test_gem_commands_generate_index_command.rb
+++ b/test/rubygems/test_gem_commands_generate_index_command.rb
@@ -3,6 +3,10 @@ require 'rubygems/test_case'
require 'rubygems/indexer'
require 'rubygems/commands/generate_index_command'
+unless defined?(Builder::XChar)
+ warn "generate_index tests are being skipped. Install builder gem."
+end
+
class TestGemCommandsGenerateIndexCommand < Gem::TestCase
def setup
@@ -22,6 +26,18 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
assert File.exist?(specs), specs
end
+ def test_execute_no_modern
+ @cmd.options[:modern] = false
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ specs = File.join @gemhome, "specs.4.8.gz"
+
+ assert File.exist?(specs), specs
+ end
+
def test_handle_options_directory
return if win_platform?
refute_equal '/nonexistent', @cmd.options[:directory]
@@ -47,4 +63,24 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
assert @cmd.options[:update]
end
-end if ''.respond_to? :to_xs
+ def test_handle_options_modern
+ use_ui @ui do
+ @cmd.handle_options %w[--modern]
+ end
+
+ assert_equal \
+ "WARNING: The \"--modern\" option has been deprecated and will be removed in Rubygems 4.0. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.\n",
+ @ui.error
+ end
+
+ def test_handle_options_no_modern
+ use_ui @ui do
+ @cmd.handle_options %w[--no-modern]
+ end
+
+ assert_equal \
+ "WARNING: The \"--no-modern\" option has been deprecated and will be removed in Rubygems 4.0. The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.\n",
+ @ui.error
+ end
+
+end if defined?(Builder::XChar)