Class: PluginManagerCliOptions
- Inherits:
-
MiniTest::Test
- Object
- MiniTest::Test
- PluginManagerCliOptions
- Includes:
- CorePluginUnitHelper
- Defined in:
- lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb
Overview
———————————————————————–# Thor option defs ———————————————————————–#
Instance Method Summary collapse
- #setup ⇒ Object
- #test_install_args ⇒ Object
- #test_list_args ⇒ Object
- #test_search_args ⇒ Object
- #test_uninstall_args ⇒ Object
- #test_update_args ⇒ Object
Instance Method Details
#setup ⇒ Object
10 11 12 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 10 def setup require_relative '../../lib/inspec-plugin-manager-cli/cli_command' end |
#test_install_args ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 50 def test_install_args arg_config = cli_class.all_commands['install']. assert_equal 1, arg_config.count, 'The install command should have 1 option' assert_includes arg_config.keys, :version, 'The install command should have a --version option' assert_equal :string, arg_config[:version].type, 'The --version option should be a string' assert_equal :v, arg_config[:version].aliases.first, 'The --version option should be aliased as -v' refute_nil arg_config[:version].description, 'The --version option should have a description' refute arg_config[:version].required, 'The --version option should not be required' assert_equal 1, cli_class.instance_method(:install).arity, 'The install command should take one argument' end |
#test_list_args ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 14 def test_list_args arg_config = cli_class.all_commands['list']. assert_equal 1, arg_config.count, 'The list command should have 1 option' assert_includes arg_config.keys, :all, 'The list command should have an --all option' assert_equal :boolean, arg_config[:all].type, 'The --all option should be boolean' assert_equal :a, arg_config[:all].aliases.first, 'The --all option should be aliased as -a' refute_nil arg_config[:all].description, 'The --all option should have a description' refute arg_config[:all].required, 'The --all option should not be required' assert_equal 0, cli_class.instance_method(:list).arity, 'The list command should take no arguments' end |
#test_search_args ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 27 def test_search_args arg_config = cli_class.all_commands['search']. assert_equal 3, arg_config.count, 'The search command should have 3 options' assert_includes arg_config.keys, :all, 'The search command should have an --all option' assert_equal :boolean, arg_config[:all].type, 'The --all option should be boolean' assert_equal :a, arg_config[:all].aliases.first, 'The --all option should be aliased as -a' refute_nil arg_config[:all].description, 'The --all option should have a description' refute arg_config[:all].required, 'The --all option should not be required' assert_includes arg_config.keys, :exact, 'The search command should have an --exact option' assert_equal :boolean, arg_config[:exact].type, 'The --exact option should be boolean' assert_equal :e, arg_config[:exact].aliases.first, 'The --exact option should be aliased as -e' refute_nil arg_config[:exact].description, 'The --exact option should have a description' refute arg_config[:exact].required, 'The --exact option should not be required' assert_includes arg_config.keys, :'include-test-fixture', 'The search command should have an --include-test-fixture option' assert_equal :boolean, arg_config[:'include-test-fixture'].type, 'The --include-test-fixture option should be boolean' refute arg_config[:'include-test-fixture'].required, 'The --include-test-fixture option should not be required' assert_equal 1, cli_class.instance_method(:search).arity, 'The search command should take one argument' end |
#test_uninstall_args ⇒ Object
70 71 72 73 74 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 70 def test_uninstall_args arg_config = cli_class.all_commands['uninstall']. assert_equal 0, arg_config.count, 'The uninstall command should have no options' assert_equal 1, cli_class.instance_method(:uninstall).arity, 'The uninstall command should take one argument' end |
#test_update_args ⇒ Object
63 64 65 66 67 68 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb', line 63 def test_update_args # TODO: allow specifying version arg_config = cli_class.all_commands['update']. assert_equal 0, arg_config.count, 'The update command should have no options' assert_equal 1, cli_class.instance_method(:update).arity, 'The update command should take one argument' end |