Fix a handful of functional tests

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-02-12 19:46:15 -05:00
parent 08ad60796f
commit c28c244f16
5 changed files with 9 additions and 7 deletions

View file

@ -132,7 +132,7 @@ module Inspec
metadata.params[:attributes].each do |attribute|
attr_dup = attribute.dup
name = attr_dup.delete(:name)
@runner_context.register_attribute(name, attr_dup)
@runner_context.register_input(name, attr_dup)
end
elsif metadata.params.key?(:attributes)
Inspec::Log.warn 'Inputs must be defined as an Array. Skipping current definition.'

View file

@ -107,7 +107,7 @@ module Inspec::Reporters
copyright: p[:copyright],
copyright_email: p[:copyright_email],
supports: p[:supports],
attributes: p[:attributes], # TODO: rename field to inputs, see #3802
attributes: p[:inputs], # TODO: rename exposed field to inputs, see #3802
parent_profile: p[:parent_profile],
depends: p[:depends],
groups: profile_groups(p),

View file

@ -68,7 +68,7 @@ describe 'example inheritance profile' do
end
it 'can execute a profile inheritance' do
out = inspec('exec ' + path + ' --reporter json --no-create-lockfile --input-file ' + input_file)
out = inspec('exec ' + path + ' --reporter json --no-create-lockfile --attrs ' + input_file)
out.stderr.must_equal ''
out.exit_status.must_equal 101
JSON.load(out.stdout).must_be_kind_of Hash

View file

@ -10,7 +10,9 @@ describe 'command tests' do
out = inspec('version')
out.stderr.must_equal ''
out.exit_status.must_equal 0
out.stdout.must_equal Inspec::VERSION+"\n"
# Tolerate working on an out of date branch
output = out.stdout.split("\n").reject { |l| l.start_with?('Your version of InSpec is out of date!') }.join("\n")
output.must_equal Inspec::VERSION + "\n"
end
it 'prints the version as JSON when the format is specified as JSON' do

View file

@ -1,13 +1,13 @@
include_controls 'child_profile_NEW_NAME'
include_controls 'child_profile2' do
control 'test override control on parent using child input' do
describe input('val_numeric') do
control 'test override control on parent using child attribute' do
describe attribute('val_numeric') do
it { should cmp 654321 }
end
end
control 'test override control on parent using parent input' do
control 'test override control on parent using parent attribute' do
describe Inspec::InputRegistry.find_input('val_numeric', 'inputs').value do
it { should cmp 443 }
end