2014-10-01 00:15:02 +00:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
require 'json'
|
|
|
|
|
|
|
|
describe 'Genearting module documation using yardoc action' do
|
|
|
|
def read_file_on(host, filename)
|
|
|
|
on(host, "cat #{filename}").stdout
|
|
|
|
end
|
|
|
|
|
|
|
|
before :all do
|
|
|
|
modules = JSON.parse(on(master, puppet("module", "list", "--render-as", "json")).stdout)
|
|
|
|
test_module_info = modules["modules_by_path"].values.flatten.find { |mod_info| mod_info =~ /Module test/ }
|
|
|
|
test_module_path = test_module_info.match(/\(([^)]*)\)/)[1]
|
|
|
|
|
|
|
|
on master, puppet("strings", "#{test_module_path}/**/*.{rb,pp}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should generate documentation for manifests" do
|
2015-07-06 18:55:59 +00:00
|
|
|
expect(read_file_on(master, '/root/doc/test.html')).to include("Class: test")
|
2014-10-01 00:15:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should generate documenation for 3x functions" do
|
2015-07-06 18:55:59 +00:00
|
|
|
expect(read_file_on(master, '/root/doc/Puppet3xFunctions.html')).to include("This is the function documentation for `function3x`")
|
2014-10-01 00:15:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should generate documenation for 4x functions" do
|
2015-07-06 18:55:59 +00:00
|
|
|
expect(read_file_on(master, '/root/doc/Puppet4xFunctions.html')).to include("This is a function which is used to test puppet strings")
|
2014-10-01 00:15:02 +00:00
|
|
|
end
|
|
|
|
end
|