(PDOC-25) Add tests to ensure namespaces are correct
Prior to this commit, there were no tests to check if namespaces were being properly generated (which was why we did not catch the bug earlier). Add a test for defined type and host class handlers to ensure that namespaces are properly generated in code objects.
This commit is contained in:
parent
685ebf54eb
commit
862b090221
|
@ -58,4 +58,17 @@ describe PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler do
|
|||
|
||||
expect(YARD::Registry.all).to be_empty
|
||||
end
|
||||
|
||||
it "should generate the correct namespace " do
|
||||
puppet_code = <<-PUPPET
|
||||
define puppet_enterprise::mcollective::client::certs { }
|
||||
PUPPET
|
||||
|
||||
parse(puppet_code, :puppet)
|
||||
# If the namespace is not correctly generated, we will not be able to find the
|
||||
# object via this name, meaning namespace will be nil
|
||||
namespace = YARD::Registry.at("puppet_enterprise::mcollective::client::certs").namespace.to_s
|
||||
|
||||
expect(namespace).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,4 +46,17 @@ describe PuppetX::PuppetLabs::Strings::YARD::Handlers::HostClassHandler do
|
|||
|
||||
expect(the_hostclass).to document_a(:type => :hostclass, :docstring => "")
|
||||
end
|
||||
|
||||
it "should generate the correct namespace " do
|
||||
puppet_code = <<-PUPPET
|
||||
class puppet_enterprise::mcollective::client::certs { }
|
||||
PUPPET
|
||||
|
||||
parse(puppet_code, :puppet)
|
||||
# If the namespace is not correctly generated, we will not be able to find the
|
||||
# object via this name, meaning namespace will be nil
|
||||
namespace = YARD::Registry.at("puppet_enterprise::mcollective::client::certs")
|
||||
|
||||
expect(namespace).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue