2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2011-01-28 18:46:47 -05:00
|
|
|
require 'rubygems/test_case'
|
2007-11-10 02:48:56 -05:00
|
|
|
require 'rubygems/indexer'
|
|
|
|
require 'rubygems/commands/generate_index_command'
|
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
class TestGemCommandsGenerateIndexCommand < Gem::TestCase
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@cmd = Gem::Commands::GenerateIndexCommand.new
|
|
|
|
@cmd.options[:directory] = @gemhome
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
specs = File.join @gemhome, "specs.4.8.gz"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
assert File.exist?(specs), specs
|
2009-06-09 17:38:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_handle_options_directory
|
|
|
|
return if win_platform?
|
|
|
|
refute_equal '/nonexistent', @cmd.options[:directory]
|
|
|
|
|
|
|
|
@cmd.handle_options %w[--directory /nonexistent]
|
|
|
|
|
|
|
|
assert_equal '/nonexistent', @cmd.options[:directory]
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_handle_options_directory_windows
|
|
|
|
return unless win_platform?
|
|
|
|
|
|
|
|
refute_equal '/nonexistent', @cmd.options[:directory]
|
|
|
|
|
|
|
|
@cmd.handle_options %w[--directory C:/nonexistent]
|
|
|
|
|
|
|
|
assert_equal 'C:/nonexistent', @cmd.options[:directory]
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_handle_options_update
|
|
|
|
@cmd.handle_options %w[--update]
|
|
|
|
|
|
|
|
assert @cmd.options[:update]
|
|
|
|
end
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
end if ''.respond_to? :to_xs
|