provide inspec.version information

as a friendly shortcut and a native call within profiles

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2017-04-26 03:04:59 +02:00
parent 075336da54
commit 8e5fbb9e02
2 changed files with 11 additions and 0 deletions

View file

@ -36,6 +36,13 @@ module Inspec
"Inspec::Backend::Class @transport=#{backend.class}"
end
# Provide a shorthand to retrieve the inspec version from within a profile
#
# @return [String] inspec version
def version
Inspec::VERSION
end
define_method :backend do
connection
end

View file

@ -18,6 +18,10 @@ describe 'inspec keyword' do
load('control 1 do inspec end') # wont raise anything
end
it 'provides version information' do
load('inspec.version').must_equal Inspec::VERSION
end
it 'is associated with resources' do
i = load('os.inspec')
i.wont_be_nil