Sha256: 247792bd9cf02987f789a5ea08cfd13073b6d81537770b07554c8c32e51c5c46

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann

require 'functional/helper'

describe 'example inheritance profile' do
  include FunctionalHelper
  let(:path) { File.join(examples_path, 'inheritance') }

  [
    'archive %s --overwrite',
    'check %s',
    'json %s',
  ].each do |cmd|
    it cmd[/^\w/] + ' fails without --profiles-path' do
      out = inspec(format(cmd, path))
      out.stderr.must_include 'You must supply a --profiles-path to inherit'
      # out.stdout.must_equal '' => we still get partial output
      out.exit_status.must_equal 1
    end
  end

  it 'check succeeds with --profiles-path' do
    out = inspec('check ' + path + ' --profiles-path ' + examples_path)
    out.stderr.must_equal ''
    out.stdout.must_match /Valid.*true/
    out.exit_status.must_equal 0
  end

  it 'archive is successful with --profiles-path' do
    out = inspec('archive ' + path + ' --output ' + dst.path + ' --profiles-path ' + examples_path)
    out.stderr.must_equal ''
    out.stdout.must_include 'Generate archive '+dst.path
    out.stdout.must_include 'Finished archive generation.'
    out.exit_status.must_equal 0
    File.exist?(dst.path).must_equal true
  end

  it 'read the profile json with --profiles-path' do
    out = inspec('json ' + path + ' --profiles-path '+examples_path)
    out.stderr.must_equal ''
    out.exit_status.must_equal 0
    s = out.stdout
    hm = JSON.load(s)
    hm['name'].must_equal 'inheritance'
    hm['rules'].length.must_equal 1 # TODO: flatten out or search deeper!
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
inspec-0.20.1 test/functional/inheritance_test.rb
inspec-0.20.0 test/functional/inheritance_test.rb
inspec-0.19.2 test/functional/inheritance_test.rb
inspec-0.19.1 test/functional/inheritance_test.rb
inspec-0.19.0 test/functional/inheritance_test.rb
inspec-0.18.0 test/functional/inheritance_test.rb
inspec-0.17.1 test/functional/inheritance_test.rb
inspec-0.17.0 test/functional/inheritance_test.rb
inspec-0.16.4 test/functional/inheritance_test.rb