Provide a way to force it vs its for any argument

Signed-off-by: Alex Pop <apop@chef.io>
This commit is contained in:
Alex Pop 2017-02-03 19:26:02 +00:00
parent 2fa8039f60
commit 52842de552
2 changed files with 15 additions and 2 deletions

View file

@ -53,7 +53,7 @@ module Inspec
# this will go in its()
xres = last_call
else
res += '.' + ruby_qualifier(last)
res += '.' + ruby_qualifier(last) unless last_call.empty?
end
end

View file

@ -8,7 +8,7 @@ require 'inspec/objects'
describe 'Objects' do
describe 'Inspec::Test' do
let(:obj) { Inspec::Test.new }
it 'constructs a simple resource+argument' do
it 'constructs a simple resource + its("argument")' do
obj.qualifier = [['resource'], ['version']]
obj.matcher = 'cmp >='
obj.expectation = '2.4.2'
@ -19,6 +19,19 @@ end
'.strip
end
# same as the above test but with it
it 'constructs a simple resource.argument' do
# [''] forces an 'it' instead of 'its':
obj.qualifier = [['resource'], ['version'], ['']]
obj.matcher = 'cmp >='
obj.expectation = '2.4.2'
obj.to_ruby.must_equal '
describe resource.version do
it { should cmp >= "2.4.2" }
end
'.strip
end
it 'constructs a simple resource+argument with to_s' do
obj.qualifier = [['resource'], ['to_s']]
obj.matcher = 'cmp'