Method: PluginManagerCliInstall#test_refuse_install_when_already_installed_same_version

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

#test_refuse_install_when_already_installed_same_versionObject



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 499

def test_refuse_install_when_already_installed_same_version
  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-2-float", tmp_dir)
  end

  install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture", pre_run: pre_block)
  assert_empty install_result.stderr
  assert_equal 2, install_result.exit_status, "Exit status should be 2"

  refusal_message = install_result.stdout.split("\n").grep(/refusing/).last
  refute_nil refusal_message, "Should find a failure message at the end"
  assert_includes refusal_message, "inspec-test-fixture"
  assert_includes refusal_message, "0.2.0"
  assert_includes refusal_message, "Plugin already installed at latest version"
end