Class: PluginManagerCliDefinitionTests
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- PluginManagerCliDefinitionTests
- Includes:
- CorePluginUnitHelper
- Defined in:
- lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb
Overview
———————————————————————–# Plugin Definition ———————————————————————–#
Constant Summary collapse
- @@orig_home =
Dir.home
Instance Method Summary collapse
-
#reset_globals ⇒ Object
TODO: REFACTOR this with install/loader tests.
- #setup ⇒ Object
- #teardown ⇒ Object
- #test_plugin_registered ⇒ Object
Instance Method Details
#reset_globals ⇒ Object
TODO: REFACTOR this with install/loader tests
22 23 24 25 26 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb', line 22 def reset_globals # TODO: REFACTOR this with install/loader tests ENV["HOME"] = @@orig_home ENV["INSPEC_CONFIG_DIR"] = nil Inspec::Plugin::V2::Registry.instance.__reset end |
#setup ⇒ Object
11 12 13 14 15 16 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb', line 11 def setup mock_path = File. "test/unit/mock" @config_dir_path = File.join(mock_path, "config_dirs") ENV["HOME"] = File.join(@config_dir_path, "fakehome") end |
#teardown ⇒ Object
18 19 20 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb', line 18 def teardown reset_globals end |
#test_plugin_registered ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb', line 28 def test_plugin_registered loader = Inspec::Plugin::V2::Loader.new loader.load_all # We want to ensure it is auto-loaded assert registry.known_plugin?(:'inspec-plugin-manager-cli'), "inspec-plugin-manager-cli should be registered" assert registry.loaded_plugin?(:'inspec-plugin-manager-cli'), "inspec-plugin-manager-cli should be loaded" status = registry[:'inspec-plugin-manager-cli'] assert_equal 2, status.api_generation, "inspec-plugin-manager-cli should be v2" assert_includes status.plugin_types, :cli_command, "inspec-plugin-manager-cli should have cli_command activators" end |