Method: PluginManagerCliList#test_list_when_gem_and_path_plugins_installed

Defined in:
lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb

#test_list_when_gem_and_path_plugins_installedObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 94

def test_list_when_gem_and_path_plugins_installed
  pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
    plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
    copy_in_core_config_dir('test-fixture-1-float', tmp_dir)
  end

  result = run_inspec_process_with_this_plugin('plugin list', pre_run: pre_block)
  assert_equal 0, result.exit_status, 'exist status must be 0'
  assert_includes result.stdout, '2 plugin(s) total', 'gem+path should show two plugins'

  # Plugin Name                   Version   Via     ApiVer
  # -------------------------------------------------------
  #  inspec-meaning-of-life        src       path    2
  #  inspec-test-fixture           0.1.0     gem     2
  # -------------------------------------------------------
  #  2 plugin(s) total
  gem_line = result.stdout.split("\n").grep(/gem/).first
  assert_match(/\s*inspec-\S+\s+\d+\.\d+\.\d+\s+gem\s+2/, gem_line)
  path_line = result.stdout.split("\n").grep(/path/).first
  assert_match(/\s*inspec-\S+\s+src\s+path\s+2/, path_line)
end