spec/unit/puppet-strings/markdown_spec.rb in puppet-strings-1.2.1 vs spec/unit/puppet-strings/markdown_spec.rb in puppet-strings-2.0.0
- old
+ new
@@ -62,11 +62,44 @@
String $param3 = 'hi',
Boolean $param4 = true
) {
}
SOURCE
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_PLANS
+# A simple plan.
+# @param param1 First param.
+# @param param2 Second param.
+# @param param3 Third param.
+plan plann(String $param1, $param2, Integer $param3 = 1) {
+}
+SOURCE
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :json)
+{
+ "description": "Allows you to backup your database to local file.",
+ "input_method": "stdin",
+ "parameters": {
+ "database": {
+ "description": "Database to connect to",
+ "type": "Optional[String[1]]"
+ },
+ "user": {
+ "description": "The user",
+ "type": "Optional[String[1]]"
+ },
+ "password": {
+ "description": "The password",
+ "type": "Optional[String[1]]"
+ },
+ "sql": {
+ "description": "Path to file you want backup to",
+ "type": "String[1]"
+ }
+ }
+}
+SOURCE
+
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
# A simple Puppet function.
# @param param1 First param.
# @param param2 Second param.
# @param param3 Third param.
@@ -185,11 +218,11 @@
end
end
Puppet::ResourceApi.register_type(
name: 'apt_key',
- desc: <<-EOS,
+ docs: <<-EOS,
@summary Example resource type using the new API.
@raise SomeError
This type provides Puppet with the capabilities to manage GPG keys needed
by apt to perform package validation. Apt has it's own GPG keyring that can
be manipulated through the `apt-key` command.
@@ -225,24 +258,24 @@
},
)
SOURCE
end
- let(:filename) { 'output.md' }
+ let(:filename) do
+ if TEST_PUPPET_PLANS
+ 'output_with_plan.md'
+ else
+ 'output.md'
+ end
+ end
let(:baseline_path) { File.join(File.dirname(__FILE__), "../../fixtures/unit/markdown/#{filename}") }
let(:baseline) { File.read(baseline_path) }
describe 'rendering markdown to a file' do
it 'should output the expected markdown content' do
Tempfile.open('md') do |file|
PuppetStrings::Markdown.render(file.path)
expect(File.read(file.path)).to eq(baseline)
end
- end
- end
-
- describe 'rendering markdown to stdout' do
- it 'should output the expected markdown content' do
- expect{ PuppetStrings::Markdown.render }.to output(baseline).to_stdout
end
end
end