mirror of
https://github.com/inspec/inspec
synced 2024-12-24 20:13:16 +00:00
ed44b34509
* A functional test for attributes * Add tests for nested attrs in yaml * remove commented-out tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
25 lines
No EOL
657 B
Ruby
25 lines
No EOL
657 B
Ruby
expecteds = {
|
|
an_integer: 1,
|
|
a_quoted_string: 'Should not have quotes',
|
|
an_unquoted_string: 'Should not have quotes',
|
|
lowercase_true: true,
|
|
titlecase_true: true,
|
|
titlecase_false: false,
|
|
}
|
|
tests = expecteds.keys.map do |test_name|
|
|
{
|
|
name: test_name,
|
|
expected: expecteds[test_name],
|
|
attr_via_string: attribute(test_name.to_s, default: "#{test_name}_default"),
|
|
attr_via_symbol: attribute(test_name, default: "#{test_name}_default"),
|
|
}
|
|
end
|
|
|
|
control 'flat' do
|
|
tests.each do |info|
|
|
describe "#{info[:name]} using string key" do
|
|
subject { info[:attr_via_string] }
|
|
it { should eq info[:expected] }
|
|
end
|
|
end
|
|
end |