diff --git a/spec/acceptance/running_strings_generate.rb b/spec/acceptance/running_strings_generate.rb index 48c2104..8aac81e 100644 --- a/spec/acceptance/running_strings_generate.rb +++ b/spec/acceptance/running_strings_generate.rb @@ -38,4 +38,21 @@ describe 'Generating module documentation using generate action' do it 'should generate documentation for 4x functions' do expect(read_file_on(master, '/root/doc/puppet_functions_ruby4x/function4x.html')).to include('This is a function which is used to test puppet strings') end + + it 'should generate documentation for custom types' do + html_output = read_file_on(master, '/root/doc/puppet_types/database.html') + expect(html_output).to include('
An example server resource type.
') + expect(html_output).to include('The database file to use.
') + expect(html_output).to include('Documentation for a dynamic property.
') + expect(html_output).to include('The database server name.
') + expect(html_output).to include('Documentation for a dynamic parameter.
') + expect(html_output).to include('The provider supports encryption.
') + end + + it 'should generate documentation for custom providers' do + html_output = read_file_on(master, '/root/doc/puppet_providers_database/linux.html') + expect(html_output).to include('The database provider on Linux') + expect(html_output).to include('osfamily — linux') + expect(html_output).to include('database — /usr/bin/database') + end end diff --git a/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb b/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb new file mode 100644 index 0000000..7f354e1 --- /dev/null +++ b/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb @@ -0,0 +1,9 @@ +Puppet::Type.type(:database).provide :linux do + confine 'osfamily' => 'linux' + defaultfor 'osfamily' => 'linux' + commands :database => '/usr/bin/database' + + desc 'The database provider on Linux.' + + # ... +end diff --git a/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb b/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb new file mode 100644 index 0000000..ff9e8ef --- /dev/null +++ b/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb @@ -0,0 +1,15 @@ +# @!puppet.type.param [value1, value2, value3] my_param Documentation for a dynamic parameter. +# @!puppet.type.property [foo, bar, baz] my_prop Documentation for a dynamic property. +Puppet::Type.newtype(:database) do + desc 'An example server resource type.' + feature :encryption, 'The provider supports encryption.', methods: [:encrypt] + + newparam(:address) do + isnamevar + desc 'The database server name.' + end + + newproperty(:file) do + desc 'The database file to use.' + end +end