Merge pull request #77 from HAIL9000/issue/master/PDOC-75-strings_fails_with_puppet_4.4.0
(PDOC-75) Work with both versions of 'interpret_any'
This commit is contained in:
commit
a3227b8b1f
|
@ -16,7 +16,13 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::HostClassHandler < PuppetX::
|
||||||
param_type_info[pop_param.name] = Puppet::Pops::Types::TypeFactory.any()
|
param_type_info[pop_param.name] = Puppet::Pops::Types::TypeFactory.any()
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr)
|
# This is a bit of a hack because we were using a method that was previously
|
||||||
|
# API private. See PDOC-75 for more details
|
||||||
|
if Puppet::Pops::Types::TypeParser.instance_method(:interpret_any).arity == 2
|
||||||
|
param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr, nil)
|
||||||
|
else
|
||||||
|
param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_exp)
|
||||||
|
end
|
||||||
rescue Puppet::ParseError => e
|
rescue Puppet::ParseError => e
|
||||||
# If the type could not be interpreted insert a prominent warning
|
# If the type could not be interpreted insert a prominent warning
|
||||||
param_type_info[pop_param.name] = "Type Error: #{e.message}"
|
param_type_info[pop_param.name] = "Type Error: #{e.message}"
|
||||||
|
|
|
@ -20,7 +20,7 @@ module StringsSpec
|
||||||
@mismatches.empty?
|
@mismatches.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
failure_message_for_should do
|
failure_message do |actual|
|
||||||
@mismatches.collect do |key, value|
|
@mismatches.collect do |key, value|
|
||||||
"Expected #{key} to be <#{value[1]}>, but got <#{value[0]}>."
|
"Expected #{key} to be <#{value[1]}>, but got <#{value[0]}>."
|
||||||
end.join("\n")
|
end.join("\n")
|
||||||
|
|
Loading…
Reference in New Issue