Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from chef/bugfix-profile
Merged change 5ce5796b-e97e-4826-a9de-9848865207af From review branch bugfix-profile into master Signed-off-by: chartmann <chartmann@chef.io>
- Loading branch information
Showing
9 changed files
with
114 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name 'metadata profile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# encoding: utf-8 | ||
# author: Christoph Hartmann | ||
# author: Dominik Richter | ||
|
||
require 'helper' | ||
|
||
def load_profile(name) | ||
pwd = File.dirname(__FILE__) | ||
Inspec::Profile.from_path("#{pwd}/mock/profiles/#{name}") | ||
end | ||
|
||
describe Inspec::Profile do | ||
before { | ||
# mock up the profile runner | ||
# TODO: try to take the real profile runner here; | ||
# currently it's stopped at test runner conflicts | ||
class Inspec::Profile::Runner | ||
def initialize(opts) end | ||
def add_tests(tests) end | ||
def rules | ||
{} | ||
end | ||
end | ||
} | ||
|
||
describe 'with empty profile' do | ||
let(:profile) { load_profile('empty') } | ||
|
||
it 'has no metadata' do | ||
profile.params[:name].must_be_nil | ||
end | ||
|
||
it 'has no rules' do | ||
profile.params[:rules].must_equal({}) | ||
end | ||
end | ||
|
||
describe 'with normal metadata in profile' do | ||
let(:profile) { load_profile('metadata') } | ||
|
||
it 'has metadata' do | ||
profile.params[:name].must_equal 'metadata profile' | ||
end | ||
|
||
it 'has no rules' do | ||
profile.params[:rules].must_equal({}) | ||
end | ||
end | ||
end |