mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
catch corner-case with symbols on test-objects
This commit is contained in:
parent
8a9cd539fc
commit
67f7a5936c
2 changed files with 15 additions and 7 deletions
|
@ -48,13 +48,12 @@ module Inspec
|
|||
|
||||
if @qualifier.length > 1
|
||||
last = @qualifier[-1]
|
||||
unless last.is_a?(Array) && last[0].to_s.empty?
|
||||
if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].include?('[')
|
||||
# this will go in its()
|
||||
xres = last[0]
|
||||
else
|
||||
res += '.' + ruby_qualifier(last)
|
||||
end
|
||||
last_call = last.is_a?(Array) ? last[0].to_s : ''
|
||||
if last.length == 1 && last_call !~ /^to_.$/ && !last_call.include?('[') && !last_call.empty?
|
||||
# this will go in its()
|
||||
xres = last_call
|
||||
else
|
||||
res += '.' + ruby_qualifier(last)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -50,6 +50,15 @@ end
|
|||
describe resource.hello(\"world\") do
|
||||
it { should }
|
||||
end
|
||||
".strip
|
||||
end
|
||||
|
||||
it 'constructs a simple resource+argument with method calls' do
|
||||
obj.qualifier = [['resource'], [:world]]
|
||||
obj.to_ruby.must_equal "
|
||||
describe resource do
|
||||
its(\"world\") { should }
|
||||
end
|
||||
".strip
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue