Skip to content

Commit

Permalink
Merge pull request #368 from chef/dr/metadata-test
Browse files Browse the repository at this point in the history
add tests for loading metadata yaml internals
  • Loading branch information
chris-rock committed Jan 15, 2016
2 parents 0366ba2 + 4064e63 commit b3e36d9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/unit/metadata_test.rb
Expand Up @@ -9,6 +9,30 @@
describe 'running on ubuntu 14.04' do
let (:backend) { MockLoader.new(:ubuntu1404).backend }

it 'finalizes a loaded metadata via Profile ID' do
res = Inspec::Metadata.from_yaml('mock', '---', nil)
Inspec::Metadata.finalize(res, 'mock')
res.params[:name].must_equal('mock')
end

it 'finalizes a loaded metadata via Profile ID and overwrites the ID' do
res = Inspec::Metadata.from_yaml('mock', "---\nname: hello", nil)
Inspec::Metadata.finalize(res, 'mock')
res.params[:name].must_equal('mock')
end

it 'finalizes a loaded metadata by turning strings into symbols' do
res = Inspec::Metadata.from_yaml('mock', "---\nauthor: world", nil)
Inspec::Metadata.finalize(res, 'mock')
res.params[:author].must_equal('world')
end

it 'loads the support field from metadata' do
res = Inspec::Metadata.from_yaml('mock',
"---\nsupports:\n - os: ubuntu", nil)
res.params[:supports].must_equal([{ 'os' => 'ubuntu' }])
end

# Description of method
#
# @param [Type] params describe params
Expand Down

0 comments on commit b3e36d9

Please sign in to comment.