2017-04-26 00:47:01 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# author: Dominik Richter
|
|
|
|
# author: Christoph Hartmann
|
|
|
|
|
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
describe 'inspec keyword' do
|
|
|
|
def load(content)
|
|
|
|
runner = Inspec::Runner.new({backend: 'mock'})
|
|
|
|
res = runner.eval_with_virtual_profile(content)
|
|
|
|
end
|
|
|
|
|
2017-04-26 01:03:53 +00:00
|
|
|
it 'is a vailable as a global keyword' do
|
|
|
|
load('inspec') # wont raise anything
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is a vailable inside of control blocks' do
|
|
|
|
load('control 1 do inspec end') # wont raise anything
|
|
|
|
end
|
|
|
|
|
2017-04-26 01:04:59 +00:00
|
|
|
it 'provides version information' do
|
|
|
|
load('inspec.version').must_equal Inspec::VERSION
|
|
|
|
end
|
|
|
|
|
2017-04-26 00:47:01 +00:00
|
|
|
it 'is associated with resources' do
|
|
|
|
i = load('os.inspec')
|
|
|
|
i.wont_be_nil
|
|
|
|
i.backend.must_be_kind_of Train::Transports::Mock::Connection
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'prints a nice to_s' do
|
2017-04-26 01:03:53 +00:00
|
|
|
load('inspec').to_s.must_equal 'Inspec::Backend::Class'
|
2017-04-26 00:47:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'prints a nice inspect line' do
|
2017-04-26 01:03:53 +00:00
|
|
|
load('inspec').inspect.must_equal 'Inspec::Backend::Class @transport=Train::Transports::Mock::Connection'
|
2017-04-26 00:47:01 +00:00
|
|
|
end
|
|
|
|
end
|