puppet-strings 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile +14 -5
  4. data/JSON.md +41 -11
  5. data/README.md +66 -7
  6. data/Rakefile +99 -29
  7. data/lib/puppet-strings/json.rb +2 -0
  8. data/lib/puppet-strings/markdown.rb +2 -0
  9. data/lib/puppet-strings/markdown/data_type.rb +18 -0
  10. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  11. data/lib/puppet-strings/markdown/function.rb +2 -2
  12. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  13. data/lib/puppet-strings/markdown/templates/data_type.erb +78 -0
  14. data/lib/puppet-strings/tasks/generate.rb +3 -2
  15. data/lib/puppet-strings/version.rb +1 -1
  16. data/lib/puppet-strings/yard.rb +10 -0
  17. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  18. data/lib/puppet-strings/yard/code_objects/class.rb +1 -1
  19. data/lib/puppet-strings/yard/code_objects/data_type.rb +80 -0
  20. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  21. data/lib/puppet-strings/yard/code_objects/defined_type.rb +1 -1
  22. data/lib/puppet-strings/yard/code_objects/function.rb +3 -3
  23. data/lib/puppet-strings/yard/code_objects/plan.rb +1 -1
  24. data/lib/puppet-strings/yard/handlers.rb +2 -0
  25. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  26. data/lib/puppet-strings/yard/handlers/ruby/base.rb +2 -2
  27. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +236 -0
  28. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +1 -3
  29. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +2 -2
  30. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +5 -6
  31. data/lib/puppet-strings/yard/parsers/json/parser.rb +1 -1
  32. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  33. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  34. data/lib/puppet-strings/yard/tags/overload_tag.rb +1 -1
  35. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  36. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  37. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  38. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  39. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  40. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  41. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  42. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  43. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +5 -0
  44. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  45. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  46. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  47. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  48. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  49. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  50. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  51. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  52. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  53. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  54. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  55. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  56. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +1 -0
  57. data/lib/puppet/face/strings.rb +3 -3
  58. data/spec/acceptance/emit_json_options_spec.rb +69 -0
  59. data/spec/acceptance/generate_markdown_spec.rb +13 -15
  60. data/spec/acceptance/running_strings_generate_spec.rb +78 -0
  61. data/spec/fixtures/acceptance/modules/test/metadata.json +5 -1
  62. data/spec/fixtures/acceptance/modules/test/types/elephant.pp +2 -0
  63. data/spec/fixtures/unit/markdown/output_with_data_types.md +553 -0
  64. data/spec/spec_helper.rb +3 -0
  65. data/spec/spec_helper_acceptance.rb +52 -22
  66. data/spec/spec_helper_acceptance_local.rb +10 -0
  67. data/spec/unit/puppet-strings/describe_spec.rb +7 -7
  68. data/spec/unit/puppet-strings/json_spec.rb +23 -4
  69. data/spec/unit/puppet-strings/markdown/base_spec.rb +3 -3
  70. data/spec/unit/puppet-strings/markdown_spec.rb +84 -23
  71. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +1 -1
  72. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +4 -4
  73. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +8 -8
  74. data/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +65 -0
  75. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +8 -8
  76. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +13 -13
  77. data/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +232 -0
  78. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +36 -19
  79. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +26 -7
  80. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +7 -7
  81. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +26 -10
  82. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +2 -2
  83. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +42 -0
  84. data/spec/unit/puppet-strings/yard/util_spec.rb +1 -1
  85. metadata +35 -7
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/lib/util.rb +0 -163
  88. data/spec/acceptance/running_strings_generate.rb +0 -54
@@ -36,6 +36,9 @@ TEST_FUNCTION_RETURN_TYPE = Puppet::Util::Package.versioncmp(Puppet.version, "4.
36
36
  # Enable testing of Plans if Puppet version is greater than 5.0.0
37
37
  TEST_PUPPET_PLANS = Puppet::Util::Package.versioncmp(Puppet.version, "5.0.0") >= 0
38
38
 
39
+ # Enable testing of Data Types if Puppet version is greater than 4.1.0
40
+ TEST_PUPPET_DATATYPES = Puppet::Util::Package.versioncmp(Puppet.version, "4.1.0") >= 0
41
+
39
42
  RSpec.configure do |config|
40
43
  config.mock_with :mocha
41
44
 
@@ -1,28 +1,58 @@
1
- require 'beaker-rspec/spec_helper'
2
- require 'beaker-rspec/helpers/serverspec'
3
- $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'acceptance/lib'))
4
- require 'util'
1
+ require 'serverspec'
2
+ require 'puppet_litmus'
3
+ include PuppetLitmus # rubocop:disable Style/MixinUsage This is fine
5
4
 
6
- unless ENV['RS_PROVISION'] == 'no'
7
- install_puppet
8
- end
5
+ if ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost'
6
+ puts 'Running tests against this machine !'
7
+ if Gem.win_platform?
8
+ set :backend, :cmd
9
+ else
10
+ set :backend, :exec
11
+ end
12
+ else
13
+ # load inventory
14
+ inventory_hash = inventory_hash_from_inventory_file
15
+ node_config = config_from_node(inventory_hash, ENV['TARGET_HOST'])
9
16
 
10
- RSpec.configure do |c|
11
- # Readable test descriptions
12
- c.formatter = :documentation
17
+ if target_in_group(inventory_hash, ENV['TARGET_HOST'], 'docker_nodes')
18
+ host = ENV['TARGET_HOST']
19
+ set :backend, :docker
20
+ set :docker_container, host
21
+ elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'ssh_nodes')
22
+ set :backend, :ssh
23
+ options = Net::SSH::Config.for(host)
24
+ options[:user] = node_config.dig('ssh', 'user') unless node_config.dig('ssh', 'user').nil?
25
+ options[:port] = node_config.dig('ssh', 'port') unless node_config.dig('ssh', 'port').nil?
26
+ options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil?
27
+ options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil?
28
+ options[:verify_host_key] = Net::SSH::Verifiers::Null.new unless node_config.dig('ssh', 'host-key-check').nil?
29
+ host = if ENV['TARGET_HOST'].include?(':')
30
+ ENV['TARGET_HOST'].split(':').first
31
+ else
32
+ ENV['TARGET_HOST']
33
+ end
34
+ set :host, options[:host_name] || host
35
+ set :ssh_options, options
36
+ set :request_pty, true
37
+ elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'winrm_nodes')
38
+ require 'winrm'
13
39
 
14
- # Configure all nodes in nodeset
15
- c.before :suite do
16
- extend PuppetStrings::Acceptance::CommandUtils
17
- hosts.each do |host|
18
- scp_to(host, Dir.glob('puppet-strings*.gem').first, 'puppet-strings.gem')
19
- install_ca_certs(host)
20
- on host, "#{gem_command(host)} install yard"
21
- on host, "#{gem_command(host)} install rgen"
22
- on host, "#{gem_command(host)} install puppet-strings.gem"
40
+ set :backend, :winrm
41
+ set :os, family: 'windows'
42
+ user = node_config.dig('winrm', 'user') unless node_config.dig('winrm', 'user').nil?
43
+ pass = node_config.dig('winrm', 'password') unless node_config.dig('winrm', 'password').nil?
44
+ endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
23
45
 
24
- scp_to(host, Dir.glob('spec/fixtures/acceptance/modules/test/pkg/username-test*.gz').first, 'test.tar.gz')
25
- on host, puppet('module', 'install', 'test.tar.gz')
26
- end
46
+ opts = {
47
+ user: user,
48
+ password: pass,
49
+ endpoint: endpoint,
50
+ operation_timeout: 300,
51
+ }
52
+
53
+ winrm = WinRM::Connection.new opts
54
+ Specinfra.configuration.winrm = winrm
27
55
  end
28
56
  end
57
+
58
+ require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))
@@ -0,0 +1,10 @@
1
+ def sut_module_path(module_regex)
2
+ modules = JSON.parse(PuppetLitmus::Serverspec.run_shell('puppet module list --render-as json').stdout)
3
+ test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex }
4
+ test_module_info.match(/\(([^)]*)\)/)[1]
5
+ end
6
+
7
+ def sut_tmp_path
8
+ # TODO: Linux only
9
+ '/tmp/'
10
+ end
@@ -19,7 +19,7 @@ describe PuppetStrings::Describe do
19
19
  Puppet::Type.newtype(:database) do
20
20
  desc 'An example database server resource type.'
21
21
  end
22
- SOURCE
22
+ SOURCE
23
23
 
24
24
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
25
25
  Puppet::ResourceApi.register_type(
@@ -40,9 +40,9 @@ If Puppet is given the location of a key file which looks like an absolute
40
40
  path this type will autorequire that file.
41
41
  EOS
42
42
  )
43
- SOURCE
43
+ SOURCE
44
44
 
45
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
45
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
46
46
  Puppet::Type.type(:file).newproperty(:content) do
47
47
  include Puppet::Util::Checksums
48
48
  include Puppet::DataSync
@@ -54,7 +54,7 @@ SOURCE
54
54
  exclusive with `source` and `target`.
55
55
  EOT
56
56
  end
57
- SOURCE
57
+ SOURCE
58
58
 
59
59
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
60
60
  Puppet::Type.newtype(:file) do
@@ -78,7 +78,7 @@ SOURCE
78
78
  end
79
79
 
80
80
  end
81
- SOURCE
81
+ SOURCE
82
82
 
83
83
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
84
84
  Puppet::Type.type(:file).newproperty(:source) do
@@ -92,7 +92,7 @@ Puppet::Type.type(:file).newproperty(:source) do
92
92
  exclusive with `source` and `target`.
93
93
  EOT
94
94
  end
95
- SOURCE
95
+ SOURCE
96
96
  end
97
97
 
98
98
  describe 'rendering DESCRIBE to stdout' do
@@ -134,7 +134,7 @@ exclusive with `source` and `target`.
134
134
 
135
135
  Providers
136
136
  ---------
137
- DATA
137
+ DATA
138
138
  expect{ PuppetStrings::Describe.render(['file']) }.to output(output).to_stdout
139
139
  end
140
140
  end
@@ -21,7 +21,7 @@ class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
21
21
  # @param param3 Third param.
22
22
  define dt(Integer $param1, $param2, String $param3 = hi) {
23
23
  }
24
- SOURCE
24
+ SOURCE
25
25
 
26
26
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_PLANS
27
27
  # A simple plan.
@@ -30,7 +30,7 @@ SOURCE
30
30
  # @param param3 Third param.
31
31
  plan plann(String $param1, $param2, Integer $param3 = 1) {
32
32
  }
33
- SOURCE
33
+ SOURCE
34
34
 
35
35
  # Only include Puppet functions for 4.1+
36
36
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_FUNCTIONS
@@ -41,6 +41,20 @@ SOURCE
41
41
  # @return [Undef] Returns nothing.
42
42
  function func(Integer $param1, $param2, String $param3 = hi) {
43
43
  }
44
+ SOURCE
45
+
46
+ # Only include Puppet types for 5.0+
47
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) if TEST_PUPPET_DATATYPES
48
+ # Basic Puppet Data Type in Ruby
49
+ #
50
+ # @param msg A message parameter
51
+ Puppet::DataTypes.create_type('RubyDataType') do
52
+ interface <<-PUPPET
53
+ attributes => {
54
+ msg => String[1]
55
+ }
56
+ PUPPET
57
+ end
44
58
  SOURCE
45
59
 
46
60
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :json)
@@ -66,7 +80,7 @@ SOURCE
66
80
  }
67
81
  }
68
82
  }
69
- SOURCE
83
+ SOURCE
70
84
 
71
85
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
72
86
  Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC
@@ -199,7 +213,7 @@ path this type will autorequire that file.
199
213
  package: 'apt',
200
214
  },
201
215
  )
202
- SOURCE
216
+ SOURCE
203
217
  end
204
218
 
205
219
  RSpec.shared_examples "correct JSON" do
@@ -209,6 +223,11 @@ SOURCE
209
223
  expect(json_output).to include_json(puppet_class_json)
210
224
  end
211
225
 
226
+ it 'should include data for Puppet Data Types' do
227
+ data_types_json = YARD::Registry.all(:puppet_data_type).sort_by!(&:name).map!(&:to_hash).to_json
228
+ expect(json_output).to include_json(data_types_json)
229
+ end
230
+
212
231
  it 'should include data for Puppet Defined Types' do
213
232
  defined_types_json = YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash).to_json
214
233
 
@@ -12,7 +12,7 @@ describe PuppetStrings::Markdown::Base do
12
12
  # @param param3 Third param.
13
13
  class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
14
14
  }
15
- SOURCE
15
+ SOURCE
16
16
  end
17
17
 
18
18
  let(:reg) { YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash)[0] }
@@ -24,7 +24,7 @@ SOURCE
24
24
  end
25
25
  end
26
26
 
27
- [ 'examples',
27
+ ['examples',
28
28
  'see',
29
29
  'since',
30
30
  'return_val',
@@ -85,7 +85,7 @@ class klass::yeah(
85
85
  ) inherits foo::bar {
86
86
 
87
87
  }
88
- SOURCE
88
+ SOURCE
89
89
  end
90
90
 
91
91
  let(:reg) { YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash)[0] }
@@ -4,7 +4,7 @@ require 'puppet-strings/markdown/table_of_contents'
4
4
  require 'tempfile'
5
5
 
6
6
  describe PuppetStrings::Markdown do
7
- before :each do
7
+ def parse_shared_content
8
8
  # Populate the YARD registry with both Puppet and Ruby source
9
9
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
10
10
  # An overview for a simple class.
@@ -65,15 +65,7 @@ define klass::dt (
65
65
  Boolean $param4 = true
66
66
  ) {
67
67
  }
68
- SOURCE
69
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_PLANS
70
- # A simple plan.
71
- # @param param1 First param.
72
- # @param param2 Second param.
73
- # @param param3 Third param.
74
- plan plann(String $param1, $param2, Integer $param3 = 1) {
75
- }
76
- SOURCE
68
+ SOURCE
77
69
 
78
70
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :json)
79
71
  {
@@ -98,7 +90,7 @@ SOURCE
98
90
  }
99
91
  }
100
92
  }
101
- SOURCE
93
+ SOURCE
102
94
 
103
95
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
104
96
  # A simple Puppet function.
@@ -112,7 +104,7 @@ SOURCE
112
104
  # $result = func(1, 2)
113
105
  function func(Integer $param1, $param2, String $param3 = hi) {
114
106
  }
115
- SOURCE
107
+ SOURCE
116
108
 
117
109
  YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
118
110
  # An example 4.x function.
@@ -272,24 +264,93 @@ path this type will autorequire that file.
272
264
  package: 'apt',
273
265
  },
274
266
  )
275
- SOURCE
267
+ SOURCE
276
268
  end
277
269
 
278
- let(:filename) do
279
- if TEST_PUPPET_PLANS
280
- 'output_with_plan.md'
281
- else
282
- 'output.md'
283
- end
270
+ def parse_plan_content
271
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
272
+ # A simple plan.
273
+ # @param param1 First param.
274
+ # @param param2 Second param.
275
+ # @param param3 Third param.
276
+ plan plann(String $param1, $param2, Integer $param3 = 1) {
277
+ }
278
+ SOURCE
279
+ end
280
+
281
+ def parse_data_type_content
282
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
283
+ # An example Puppet Data Type in Ruby.
284
+ #
285
+ # @param param1 A variant parameter.
286
+ # @param param2 Optional String parameter.
287
+ Puppet::DataTypes.create_type('UnitDataType') do
288
+ interface <<-PUPPET
289
+ attributes => {
290
+ param1 => Variant[Numeric, String[1,2]],
291
+ param2 => { type => Optional[String[1]], value => "param2" }
292
+ }
293
+ PUPPET
294
+ end
295
+ SOURCE
296
+
297
+ YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
298
+ # Documentation for Amodule::SimpleAlias
299
+ type Amodule::SimpleAlias = Variant[Numeric,String[1,20]]
300
+
301
+ # Documentation for Amodule::ComplexAlias
302
+ type Amodule::ComplexAlias = Struct[{
303
+ value_type => Optional[ValueType],
304
+ merge => Optional[MergeType]
305
+ }]
306
+ SOURCE
284
307
  end
285
308
  let(:baseline_path) { File.join(File.dirname(__FILE__), "../../fixtures/unit/markdown/#{filename}") }
286
309
  let(:baseline) { File.read(baseline_path) }
287
310
 
288
311
  describe 'rendering markdown to a file' do
289
- it 'should output the expected markdown content' do
290
- Tempfile.open('md') do |file|
291
- PuppetStrings::Markdown.render(file.path)
292
- expect(File.read(file.path)).to eq(baseline)
312
+ before(:each) do
313
+ parse_shared_content
314
+ end
315
+
316
+ context 'with common Puppet and ruby content' do
317
+ let(:filename) { 'output.md' }
318
+
319
+ it 'should output the expected markdown content' do
320
+ Tempfile.open('md') do |file|
321
+ PuppetStrings::Markdown.render(file.path)
322
+ expect(File.read(file.path)).to eq(baseline)
323
+ end
324
+ end
325
+ end
326
+
327
+ describe 'with Puppet Plans', :if => TEST_PUPPET_PLANS do
328
+ let(:filename) { 'output_with_plan.md' }
329
+
330
+ before(:each) do
331
+ parse_plan_content
332
+ end
333
+
334
+ it 'should output the expected markdown content' do
335
+ Tempfile.open('md') do |file|
336
+ PuppetStrings::Markdown.render(file.path)
337
+ expect(File.read(file.path)).to eq(baseline)
338
+ end
339
+ end
340
+ end
341
+
342
+ describe 'with Puppet Data Types', :if => TEST_PUPPET_DATATYPES do
343
+ let(:filename) { 'output_with_data_types.md' }
344
+
345
+ before(:each) do
346
+ parse_data_type_content
347
+ end
348
+
349
+ it 'should output the expected markdown content' do
350
+ Tempfile.open('md') do |file|
351
+ PuppetStrings::Markdown.render(file.path)
352
+ expect(File.read(file.path)).to eq(baseline)
353
+ end
293
354
  end
294
355
  end
295
356
  end
@@ -26,7 +26,7 @@ describe PuppetStrings::Yard::CodeObjects::Task do
26
26
  }
27
27
  }
28
28
  }
29
- SOURCE
29
+ SOURCE
30
30
  }
31
31
  let(:json) { JSON.parse(source) }
32
32
  let(:statement) { PuppetStrings::Yard::Parsers::JSON::TaskStatement.new(json, source, "test.json") }
@@ -18,7 +18,7 @@ describe PuppetStrings::Yard::Handlers::JSON::TaskHandler do
18
18
  }
19
19
  }
20
20
  }
21
- SOURCE
21
+ SOURCE
22
22
  }
23
23
 
24
24
  it 'should log an error' do
@@ -50,7 +50,7 @@ SOURCE
50
50
  }
51
51
  }
52
52
  }
53
- SOURCE
53
+ SOURCE
54
54
  }
55
55
 
56
56
  it 'should log a warning' do
@@ -83,7 +83,7 @@ SOURCE
83
83
  }
84
84
  }
85
85
 
86
- SOURCE
86
+ SOURCE
87
87
  }
88
88
 
89
89
  it 'should register a task object' do
@@ -105,7 +105,7 @@ SOURCE
105
105
  }
106
106
  }
107
107
  }
108
- SOURCE
108
+ SOURCE
109
109
  }
110
110
 
111
111
  it 'should output a warning' do
@@ -43,7 +43,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
43
43
  ensure => present
44
44
  }
45
45
  }
46
- SOURCE
46
+ SOURCE
47
47
  }
48
48
 
49
49
  it 'should register a class object' do
@@ -85,7 +85,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
85
85
  ensure => present
86
86
  }
87
87
  }
88
- SOURCE
88
+ SOURCE
89
89
  }
90
90
 
91
91
  it 'should output a warning' do
@@ -103,7 +103,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
103
103
  ensure => present
104
104
  }
105
105
  }
106
- SOURCE
106
+ SOURCE
107
107
  }
108
108
 
109
109
  it 'should output a warning' do
@@ -122,7 +122,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
122
122
  ensure => present
123
123
  }
124
124
  }
125
- SOURCE
125
+ SOURCE
126
126
  }
127
127
 
128
128
  it 'should respect the type that was documented' do
@@ -145,7 +145,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
145
145
  ensure => present
146
146
  }
147
147
  }
148
- SOURCE
148
+ SOURCE
149
149
  }
150
150
 
151
151
  it 'should output a warning' do
@@ -164,7 +164,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
164
164
  ensure => present
165
165
  }
166
166
  }
167
- SOURCE
167
+ SOURCE
168
168
  }
169
169
 
170
170
  it 'should respect the type that was documented' do
@@ -186,7 +186,7 @@ SOURCE
186
186
  ensure => present
187
187
  }
188
188
  }
189
- SOURCE
189
+ SOURCE
190
190
  }
191
191
 
192
192
  it 'should parse the summary' do
@@ -206,7 +206,7 @@ SOURCE
206
206
  ensure => present
207
207
  }
208
208
  }
209
- SOURCE
209
+ SOURCE
210
210
  }
211
211
 
212
212
  it 'should log a warning' do