diff --git a/spec/unit/puppet_x/puppetlabs/strings/yard/defined_type_handler_spec.rb b/spec/unit/puppet_x/puppetlabs/strings/yard/defined_type_handler_spec.rb index 7d684da..542393c 100644 --- a/spec/unit/puppet_x/puppetlabs/strings/yard/defined_type_handler_spec.rb +++ b/spec/unit/puppet_x/puppetlabs/strings/yard/defined_type_handler_spec.rb @@ -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 diff --git a/spec/unit/puppet_x/puppetlabs/strings/yard/host_class_handler_spec.rb b/spec/unit/puppet_x/puppetlabs/strings/yard/host_class_handler_spec.rb index 638eaaa..d926672 100644 --- a/spec/unit/puppet_x/puppetlabs/strings/yard/host_class_handler_spec.rb +++ b/spec/unit/puppet_x/puppetlabs/strings/yard/host_class_handler_spec.rb @@ -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