Sha256: 5530ac46b193873977d0d410a2f117879331250fcbce1a6d8a8c1d51d6b1212c

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

require_relative '../../../shared/core_plugin_test_helper.rb'
require 'fileutils'

class ProfileCli < MiniTest::Test
  include CorePluginFunctionalHelper

  def setup
    @tmpdir = Dir.mktmpdir
    @habitat_profile = File.join(@tmpdir, 'habitat-profile')
    run_inspec_process('init profile ' + @habitat_profile)
  end

  def teardown
    FileUtils.remove_entry_secure(@tmpdir)
  end

  def test_setup_subcommand
    result = run_inspec_process('habitat profile setup ' + @habitat_profile + ' --log-level debug')

    # Command runs without error
    assert_empty result.stderr
    assert_equal 0, result.exit_status

    # Command creates only expected files
    base_dir = File.join(@tmpdir, 'habitat-profile', 'habitat')
    files = %w{
      default.toml
      plan.sh
      config
      config/inspec_exec_config.json
      hooks
      hooks/run
    }
    actual_files = Dir.glob(File.join(base_dir, '**/*'))
    expected_files = files.map { |x| File.join(base_dir, x) }
    assert_equal actual_files.sort, expected_files.sort
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
inspec-4.3.2 lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-4.2.0.preview lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-4.1.4.preview lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-3.9.3 lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-3.9.0 lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-core-3.7.11 lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb
inspec-3.7.11 lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb