provide the inspec keyword

Instead of my favorite shortcut of `os.inspec` just finally add it as a global keyword.

Preparation for https://github.com/chef/inspec/issues/1396

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2017-04-26 03:03:53 +02:00
parent bf1d2ded6d
commit 8b7ef09f85
2 changed files with 14 additions and 2 deletions

View file

@ -48,6 +48,10 @@ module Inspec
r.new(backend, id.to_s, *args)
end
end
define_method :inspec do
backend
end
end
end
end

View file

@ -10,6 +10,14 @@ describe 'inspec keyword' do
res = runner.eval_with_virtual_profile(content)
end
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
it 'is associated with resources' do
i = load('os.inspec')
i.wont_be_nil
@ -17,10 +25,10 @@ describe 'inspec keyword' do
end
it 'prints a nice to_s' do
load('os.inspec').to_s.must_equal 'Inspec::Backend::Class'
load('inspec').to_s.must_equal 'Inspec::Backend::Class'
end
it 'prints a nice inspect line' do
load('os.inspec').inspect.must_equal 'Inspec::Backend::Class @transport=Train::Transports::Mock::Connection'
load('inspec').inspect.must_equal 'Inspec::Backend::Class @transport=Train::Transports::Mock::Connection'
end
end