1require 'rubygems/test_case' 2require 'rubygems/indexer' 3require 'rubygems/commands/generate_index_command' 4 5class TestGemCommandsGenerateIndexCommand < Gem::TestCase 6 7 def setup 8 super 9 10 @cmd = Gem::Commands::GenerateIndexCommand.new 11 @cmd.options[:directory] = @gemhome 12 end 13 14 def test_execute 15 use_ui @ui do 16 @cmd.execute 17 end 18 19 specs = File.join @gemhome, "specs.4.8.gz" 20 21 assert File.exist?(specs), specs 22 end 23 24 def test_handle_options_directory 25 return if win_platform? 26 refute_equal '/nonexistent', @cmd.options[:directory] 27 28 @cmd.handle_options %w[--directory /nonexistent] 29 30 assert_equal '/nonexistent', @cmd.options[:directory] 31 end 32 33 def test_handle_options_directory_windows 34 return unless win_platform? 35 36 refute_equal '/nonexistent', @cmd.options[:directory] 37 38 @cmd.handle_options %w[--directory C:/nonexistent] 39 40 assert_equal 'C:/nonexistent', @cmd.options[:directory] 41 end 42 43 def test_handle_options_update 44 @cmd.handle_options %w[--update] 45 46 assert @cmd.options[:update] 47 end 48 49end if ''.respond_to? :to_xs 50 51