mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
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:
parent
bf1d2ded6d
commit
8b7ef09f85
2 changed files with 14 additions and 2 deletions
|
@ -48,6 +48,10 @@ module Inspec
|
|||
r.new(backend, id.to_s, *args)
|
||||
end
|
||||
end
|
||||
|
||||
define_method :inspec do
|
||||
backend
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue