diff --git a/lib/inspec/objects/test.rb b/lib/inspec/objects/test.rb index 2de6bce50..fd066c839 100644 --- a/lib/inspec/objects/test.rb +++ b/lib/inspec/objects/test.rb @@ -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 diff --git a/test/unit/dsl/objects_test.rb b/test/unit/dsl/objects_test.rb index 506e03e6c..6ba928d50 100644 --- a/test/unit/dsl/objects_test.rb +++ b/test/unit/dsl/objects_test.rb @@ -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'