require 'spec_helper_acceptance' require 'util' require 'json' include PuppetStrings::Acceptance::Util describe 'Generating module documentation using generate action' do before :all do test_module_path = get_test_module_path(master, /Module test/) 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 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('
test::add(1, 2) => 3
')
expect(html_output).to include('The first integer to add.
') expect(html_output).to include('The second integer to add.
') expect(html_output).to include('Returns the sum of x and y.
') end end it 'should generate documentation for 3x functions' do expect(read_file_on(master, '/root/doc/puppet_functions_ruby3x/function3x.html')).to include('This is the function documentation forfunction3x
')
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
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