2016-09-14 19:20:26 +00:00
require 'spec_helper_acceptance'
2016-09-30 23:32:43 +00:00
require 'util'
2016-09-14 19:20:26 +00:00
require 'json'
2016-09-30 23:32:43 +00:00
include PuppetStrings :: Acceptance :: Util
2016-09-14 19:20:26 +00:00
2016-09-30 23:32:43 +00:00
describe 'Generating module documentation using generate action' do
2016-09-14 19:20:26 +00:00
before :all do
2016-09-30 23:32:43 +00:00
test_module_path = get_test_module_path ( master , / Module test / )
2016-09-14 19:20:26 +00:00
on master , puppet ( 'strings' , 'generate' , " #{ test_module_path } /**/*.{rb,pp} " )
end
it 'should generate documentation for manifests' do
expect ( read_file_on ( master , '/root/doc/puppet_classes/test.html' ) ) . to include ( 'Class: test' )
end
2016-09-29 22:58:06 +00:00
it 'should generate documentation for puppet functions' do
puppet_version = on ( master , facter ( 'puppetversion' ) ) . stdout . chomp . to_i
if puppet_version > = 4
html_output = read_file_on ( master , '/root/doc/puppet_functions_puppet/test_3A_3Aadd.html' )
expect ( html_output ) . to include ( 'Adds two integers together.' )
expect ( html_output ) . to include ( '<pre class="example code"><code>test::add(1, 2) => 3</code></pre>' )
expect ( html_output ) . to include ( '<p>The first integer to add.</p>' )
expect ( html_output ) . to include ( '<p>The second integer to add.</p>' )
expect ( html_output ) . to include ( '<p>Returns the sum of x and y.</p>' )
end
end
2016-09-14 19:20:26 +00:00
it 'should generate documentation for 3x functions' do
2016-09-16 22:01:21 +00:00
expect ( read_file_on ( master , '/root/doc/puppet_functions_ruby3x/function3x.html' ) ) . to include ( 'This is the function documentation for <code>function3x</code>' )
2016-09-14 19:20:26 +00:00
end
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
2016-09-30 22:08:19 +00:00
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
2016-09-14 19:20:26 +00:00
end