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,15 +48,14 @@ module Inspec
|
||||||
|
|
||||||
if @qualifier.length > 1
|
if @qualifier.length > 1
|
||||||
last = @qualifier[-1]
|
last = @qualifier[-1]
|
||||||
unless last.is_a?(Array) && last[0].to_s.empty?
|
last_call = last.is_a?(Array) ? last[0].to_s : ''
|
||||||
if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].include?('[')
|
if last.length == 1 && last_call !~ /^to_.$/ && !last_call.include?('[') && !last_call.empty?
|
||||||
# this will go in its()
|
# this will go in its()
|
||||||
xres = last[0]
|
xres = last_call
|
||||||
else
|
else
|
||||||
res += '.' + ruby_qualifier(last)
|
res += '.' + ruby_qualifier(last)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
[res, xres]
|
[res, xres]
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,6 +50,15 @@ end
|
||||||
describe resource.hello(\"world\") do
|
describe resource.hello(\"world\") do
|
||||||
it { should }
|
it { should }
|
||||||
end
|
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
|
".strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue