catch corner-case with symbols on test-objects

This commit is contained in:
Dominik Richter 2016-05-13 20:33:28 +02:00
parent 8a9cd539fc
commit 67f7a5936c
2 changed files with 15 additions and 7 deletions

View file

@ -48,13 +48,12 @@ 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

View file

@ -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