Updated RubySpec submodule to 9f66d0b1.
[rbx.git] / test / rubygems / test_gem_install_update_options.rb
blob8c7a5ce3f75b07ed4e825eb0c48ff77a6a824f2f
1 require 'test/unit'
2 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
3 require 'rubygems/install_update_options'
4 require 'rubygems/command'
6 class TestGemInstallUpdateOptions < RubyGemTestCase
8   def setup
9     super
11     @cmd = Gem::Command.new 'dummy', 'dummy'
12     @cmd.extend Gem::InstallUpdateOptions
13   end
15   def test_add_install_update_options
16     @cmd.add_install_update_options
18     args = %w[-i /install_to --rdoc --ri -E -f -t -w -P HighSecurity
19               --ignore-dependencies --format-exec --include-dependencies]
21     assert @cmd.handles?(args)
22   end
24   def test_security_policy
25     @cmd.add_install_update_options
27     @cmd.handle_options %w[-P HighSecurity]
29     assert_equal Gem::Security::HighSecurity, @cmd.options[:security_policy]
30   end
32   def test_security_policy_unknown
33     @cmd.add_install_update_options
35     assert_raise OptionParser::InvalidArgument do
36       @cmd.handle_options %w[-P UnknownSecurity]
37     end
38   end
40 end