diff --git a/spec/unit/puppet/examples/test/manifests/triple_nested_classes.pp b/spec/unit/puppet/examples/test/manifests/triple_nested_classes.pp new file mode 100644 index 0000000..6ac95cd --- /dev/null +++ b/spec/unit/puppet/examples/test/manifests/triple_nested_classes.pp @@ -0,0 +1,27 @@ +# Testing tested classes +# docs stuff +# @param nameservers [String] Don't ask me what this does! +# @param default_lease_time [Integer[1024, 8192]] text goes here +# @param max_lease_time does stuff +class outer ( + $dnsdomain, + $nameservers, + $default_lease_time = 3600, + $max_lease_time = 86400 + ) { + # @param options [String[5,7]] gives user choices + # @param multicast [Boolean] foobar + # @param servers yep, that's right + class middle ( + $options = "iburst", + $servers, + $multicast = false + ) { + class inner ( + $choices = "uburst", + $secenekler = "weallburst", + $boxen, + $manyspell = true + ) {} + } +} diff --git a/spec/unit/puppet/face_spec.rb b/spec/unit/puppet/face_spec.rb index 5119c41..015c051 100644 --- a/spec/unit/puppet/face_spec.rb +++ b/spec/unit/puppet/face_spec.rb @@ -79,6 +79,36 @@ describe Puppet::Face do expect(read_html(tmp, 'test', 'Puppet4xFunctions.html')).to include("This is a function which is used to test puppet strings") end end + + it "should create correct files for nested classes" do + using_module('test') do |tmp| + Dir.chdir('test') + + Puppet::Face[:strings, :current].yardoc + + expect(read_html(tmp, + 'test', 'outer.html')).to include("Puppet Class: outer") + expect(read_html(tmp, 'test', + 'outer/middle.html')).to include("Puppet Class: middle") + expect(read_html(tmp, 'test', + 'outer/middle/inner.html')).to include("Puppet Class: inner") + end + end + + it "should create proper namespace for nested classes" do + using_module('test') do |tmp| + Dir.chdir('test') + + Puppet::Face[:strings, :current].yardoc + + expect(read_html(tmp, + 'test', 'outer.html')).to include("Hostclass: outer") + expect(read_html(tmp, 'test', + 'outer/middle.html')).to include("Hostclass: outer::middle") + expect(read_html(tmp, 'test', + 'outer/middle/inner.html')).to include("Hostclass: outer::middle::inner") + end + end end end