(PDOC-88) Add tests for types and providers into acceptance
This commit is contained in:
parent
beb79d3a63
commit
3af15ce4f1
|
@ -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('<p>An example server resource type.</p>')
|
||||
expect(html_output).to include('<p>The database file to use.</p>')
|
||||
expect(html_output).to include('<p>Documentation for a dynamic property.</p>')
|
||||
expect(html_output).to include('<p>The database server name.</p>')
|
||||
expect(html_output).to include('<p>Documentation for a dynamic parameter.</p>')
|
||||
expect(html_output).to include('<p>The provider supports encryption.</p>')
|
||||
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('<tt>osfamily — linux</tt>')
|
||||
expect(html_output).to include('<tt>database — /usr/bin/database</tt>')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue