Merge pull request #1457 from chef/ap/its-it-thats-it

Provide a way to force it vs its for any argument
This commit is contained in:
Dominik Richter 2017-02-03 20:48:36 +01:00 committed by GitHub
commit f8d319c1ac
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'