mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
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:
commit
f8d319c1ac
2 changed files with 15 additions and 2 deletions
|
@ -53,7 +53,7 @@ module Inspec
|
||||||
# this will go in its()
|
# this will go in its()
|
||||||
xres = last_call
|
xres = last_call
|
||||||
else
|
else
|
||||||
res += '.' + ruby_qualifier(last)
|
res += '.' + ruby_qualifier(last) unless last_call.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ require 'inspec/objects'
|
||||||
describe 'Objects' do
|
describe 'Objects' do
|
||||||
describe 'Inspec::Test' do
|
describe 'Inspec::Test' do
|
||||||
let(:obj) { Inspec::Test.new }
|
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.qualifier = [['resource'], ['version']]
|
||||||
obj.matcher = 'cmp >='
|
obj.matcher = 'cmp >='
|
||||||
obj.expectation = '2.4.2'
|
obj.expectation = '2.4.2'
|
||||||
|
@ -19,6 +19,19 @@ end
|
||||||
'.strip
|
'.strip
|
||||||
end
|
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
|
it 'constructs a simple resource+argument with to_s' do
|
||||||
obj.qualifier = [['resource'], ['to_s']]
|
obj.qualifier = [['resource'], ['to_s']]
|
||||||
obj.matcher = 'cmp'
|
obj.matcher = 'cmp'
|
||||||
|
|
Loading…
Reference in a new issue