Method: PluginManagerCliInstall#test_refuse_install_when_already_installed_can_update

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

#test_refuse_install_when_already_installed_can_updateObject



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 516

def test_refuse_install_when_already_installed_can_update
  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

  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.1.0"
  assert_includes refusal_message, "0.2.0"
  assert_includes refusal_message, "Update required"
  assert_includes refusal_message, "inspec plugin update"
end