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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +12 -0
- data/Gemfile +14 -5
- data/JSON.md +41 -11
- data/README.md +66 -7
- data/Rakefile +99 -29
- data/lib/puppet-strings/json.rb +2 -0
- data/lib/puppet-strings/markdown.rb +2 -0
- data/lib/puppet-strings/markdown/data_type.rb +18 -0
- data/lib/puppet-strings/markdown/data_types.rb +41 -0
- data/lib/puppet-strings/markdown/function.rb +2 -2
- data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
- data/lib/puppet-strings/markdown/templates/data_type.erb +78 -0
- data/lib/puppet-strings/tasks/generate.rb +3 -2
- data/lib/puppet-strings/version.rb +1 -1
- data/lib/puppet-strings/yard.rb +10 -0
- data/lib/puppet-strings/yard/code_objects.rb +2 -0
- data/lib/puppet-strings/yard/code_objects/class.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/data_type.rb +80 -0
- data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
- data/lib/puppet-strings/yard/code_objects/defined_type.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/function.rb +3 -3
- data/lib/puppet-strings/yard/code_objects/plan.rb +1 -1
- data/lib/puppet-strings/yard/handlers.rb +2 -0
- data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
- data/lib/puppet-strings/yard/handlers/ruby/base.rb +2 -2
- data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +236 -0
- data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +1 -3
- data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +2 -2
- data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +5 -6
- data/lib/puppet-strings/yard/parsers/json/parser.rb +1 -1
- data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
- data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
- data/lib/puppet-strings/yard/tags/overload_tag.rb +1 -1
- data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
- data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
- data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
- data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +5 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
- data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
- data/lib/puppet-strings/yard/templates/default/tags/setup.rb +1 -0
- data/lib/puppet/face/strings.rb +3 -3
- data/spec/acceptance/emit_json_options_spec.rb +69 -0
- data/spec/acceptance/generate_markdown_spec.rb +13 -15
- data/spec/acceptance/running_strings_generate_spec.rb +78 -0
- data/spec/fixtures/acceptance/modules/test/metadata.json +5 -1
- data/spec/fixtures/acceptance/modules/test/types/elephant.pp +2 -0
- data/spec/fixtures/unit/markdown/output_with_data_types.md +553 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/spec_helper_acceptance.rb +52 -22
- data/spec/spec_helper_acceptance_local.rb +10 -0
- data/spec/unit/puppet-strings/describe_spec.rb +7 -7
- data/spec/unit/puppet-strings/json_spec.rb +23 -4
- data/spec/unit/puppet-strings/markdown/base_spec.rb +3 -3
- data/spec/unit/puppet-strings/markdown_spec.rb +84 -23
- data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +1 -1
- data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +4 -4
- data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +8 -8
- data/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +65 -0
- data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +8 -8
- data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +13 -13
- data/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +232 -0
- data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +36 -19
- data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +26 -7
- data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +7 -7
- data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +26 -10
- data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +2 -2
- data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +42 -0
- data/spec/unit/puppet-strings/yard/util_spec.rb +1 -1
- metadata +35 -7
- data/spec/acceptance/emit_json_options.rb +0 -71
- data/spec/acceptance/lib/util.rb +0 -163
- data/spec/acceptance/running_strings_generate.rb +0 -54
@@ -20,7 +20,7 @@ describe PuppetStrings::Yard::Handlers::Ruby::FunctionHandler do
|
|
20
20
|
let(:source) { <<-SOURCE
|
21
21
|
Puppet::Parser::Functions.newfunction(:foo) do |*args|
|
22
22
|
end
|
23
|
-
SOURCE
|
23
|
+
SOURCE
|
24
24
|
}
|
25
25
|
|
26
26
|
it 'should log a warning' do
|
@@ -38,7 +38,7 @@ An example 3.x function.
|
|
38
38
|
DOC
|
39
39
|
) do |*args|
|
40
40
|
end
|
41
|
-
SOURCE
|
41
|
+
SOURCE
|
42
42
|
}
|
43
43
|
|
44
44
|
it 'should register a function object' do
|
@@ -82,7 +82,7 @@ DOC
|
|
82
82
|
) do |*args|
|
83
83
|
end
|
84
84
|
end
|
85
|
-
SOURCE
|
85
|
+
SOURCE
|
86
86
|
}
|
87
87
|
|
88
88
|
it 'should register a function object' do
|
@@ -122,7 +122,7 @@ An example 3.x function.
|
|
122
122
|
@param second The second parameter.
|
123
123
|
DOC
|
124
124
|
end
|
125
|
-
SOURCE
|
125
|
+
SOURCE
|
126
126
|
}
|
127
127
|
|
128
128
|
it 'should log a warning' do
|
@@ -136,7 +136,7 @@ SOURCE
|
|
136
136
|
let(:source) { <<-SOURCE
|
137
137
|
Puppet::Functions.create_function(:foo) do
|
138
138
|
end
|
139
|
-
SOURCE
|
139
|
+
SOURCE
|
140
140
|
}
|
141
141
|
|
142
142
|
it 'should log a warning' do
|
@@ -149,7 +149,7 @@ SOURCE
|
|
149
149
|
# An example 4.x function.
|
150
150
|
Puppet::Functions.create_function(:foo) do
|
151
151
|
end
|
152
|
-
SOURCE
|
152
|
+
SOURCE
|
153
153
|
}
|
154
154
|
|
155
155
|
it 'should register a function object' do
|
@@ -179,7 +179,7 @@ Puppet::Functions.create_function(:foo) do
|
|
179
179
|
def foo(param1, param2, param3 = nil)
|
180
180
|
end
|
181
181
|
end
|
182
|
-
SOURCE
|
182
|
+
SOURCE
|
183
183
|
}
|
184
184
|
|
185
185
|
it 'should register a function object' do
|
@@ -231,7 +231,7 @@ Puppet::Functions.create_function(:foo) do
|
|
231
231
|
def foo(param1, param2, param3 = nil)
|
232
232
|
end
|
233
233
|
end
|
234
|
-
SOURCE
|
234
|
+
SOURCE
|
235
235
|
}
|
236
236
|
|
237
237
|
it 'should register a function object without any overload tags' do
|
@@ -285,7 +285,7 @@ Puppet::Functions.create_function(:foo) do
|
|
285
285
|
"Bar"
|
286
286
|
end
|
287
287
|
end
|
288
|
-
SOURCE
|
288
|
+
SOURCE
|
289
289
|
}
|
290
290
|
|
291
291
|
it 'does not throw an error with no @return' do
|
@@ -316,7 +316,7 @@ Puppet::Functions.create_function(:foo) do
|
|
316
316
|
repeated_param 'String', :param4
|
317
317
|
end
|
318
318
|
end
|
319
|
-
SOURCE
|
319
|
+
SOURCE
|
320
320
|
}
|
321
321
|
|
322
322
|
it 'should register a function object with the expected parameters' do
|
@@ -365,7 +365,7 @@ Puppet::Functions.create_function(:foo) do
|
|
365
365
|
optional_repeated_param 'String', :param
|
366
366
|
end
|
367
367
|
end
|
368
|
-
SOURCE
|
368
|
+
SOURCE
|
369
369
|
}
|
370
370
|
|
371
371
|
it 'should register a function object with the expected parameters' do
|
@@ -507,7 +507,7 @@ Puppet::Functions.create_function(:foo) do
|
|
507
507
|
'lol'
|
508
508
|
end
|
509
509
|
end
|
510
|
-
SOURCE
|
510
|
+
SOURCE
|
511
511
|
}
|
512
512
|
|
513
513
|
it 'should register a function object with overload tags' do
|
@@ -567,6 +567,23 @@ SOURCE
|
|
567
567
|
end
|
568
568
|
end
|
569
569
|
|
570
|
+
describe 'parsing a function with a namespaced name' do
|
571
|
+
let(:source) { <<-SOURCE
|
572
|
+
# An example 4.x function.
|
573
|
+
Puppet::Functions.create_function(:'foo::bar::baz') do
|
574
|
+
# @return [Undef]
|
575
|
+
dispatch :foo do
|
576
|
+
end
|
577
|
+
end
|
578
|
+
SOURCE
|
579
|
+
}
|
580
|
+
|
581
|
+
it 'should output the name correctly as a symbol' do
|
582
|
+
expect(subject.size).to eq(1)
|
583
|
+
expect(subject.first.name).to eq(:'foo::bar::baz')
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
570
587
|
describe 'parsing a function with a missing parameter' do
|
571
588
|
let(:source) { <<-SOURCE
|
572
589
|
# An example 4.x function.
|
@@ -576,7 +593,7 @@ Puppet::Functions.create_function(:foo) do
|
|
576
593
|
dispatch :foo do
|
577
594
|
end
|
578
595
|
end
|
579
|
-
SOURCE
|
596
|
+
SOURCE
|
580
597
|
}
|
581
598
|
|
582
599
|
it 'should output a warning' do
|
@@ -593,7 +610,7 @@ Puppet::Functions.create_function(:foo) do
|
|
593
610
|
param 'String', :param1
|
594
611
|
end
|
595
612
|
end
|
596
|
-
SOURCE
|
613
|
+
SOURCE
|
597
614
|
}
|
598
615
|
|
599
616
|
it 'should output a warning' do
|
@@ -611,7 +628,7 @@ Puppet::Functions.create_function(:foo) do
|
|
611
628
|
param 'String', :param1
|
612
629
|
end
|
613
630
|
end
|
614
|
-
SOURCE
|
631
|
+
SOURCE
|
615
632
|
}
|
616
633
|
|
617
634
|
it 'should output a warning' do
|
@@ -628,7 +645,7 @@ Puppet::Functions.create_function(:foo) do
|
|
628
645
|
param 'String', :param1
|
629
646
|
end
|
630
647
|
end
|
631
|
-
SOURCE
|
648
|
+
SOURCE
|
632
649
|
}
|
633
650
|
|
634
651
|
it 'should output a warning' do
|
@@ -645,7 +662,7 @@ Puppet::Functions.create_function(:foo) do
|
|
645
662
|
dispatch :foo do
|
646
663
|
end
|
647
664
|
end
|
648
|
-
SOURCE
|
665
|
+
SOURCE
|
649
666
|
}
|
650
667
|
|
651
668
|
it 'should output a warning' do
|
@@ -698,7 +715,7 @@ Puppet::Functions.create_function(:foo) do
|
|
698
715
|
dispatch :foo do
|
699
716
|
end
|
700
717
|
end
|
701
|
-
SOURCE
|
718
|
+
SOURCE
|
702
719
|
}
|
703
720
|
|
704
721
|
it 'should parse the summary' do
|
@@ -718,7 +735,7 @@ Puppet::Functions.create_function(:foo) do
|
|
718
735
|
dispatch :foo do
|
719
736
|
end
|
720
737
|
end
|
721
|
-
SOURCE
|
738
|
+
SOURCE
|
722
739
|
}
|
723
740
|
|
724
741
|
it 'should log a warning' do
|
@@ -19,7 +19,7 @@ describe PuppetStrings::Yard::Handlers::Ruby::ProviderHandler do
|
|
19
19
|
let(:source) { <<-SOURCE
|
20
20
|
Puppet::Type.type(:custom).provide :linux do
|
21
21
|
end
|
22
|
-
SOURCE
|
22
|
+
SOURCE
|
23
23
|
}
|
24
24
|
|
25
25
|
it 'should log a warning' do
|
@@ -32,7 +32,7 @@ SOURCE
|
|
32
32
|
Puppet::Type.type(:custom).provide :linux do
|
33
33
|
@doc = 123
|
34
34
|
end
|
35
|
-
SOURCE
|
35
|
+
SOURCE
|
36
36
|
}
|
37
37
|
|
38
38
|
it 'should log an error' do
|
@@ -45,7 +45,7 @@ SOURCE
|
|
45
45
|
Puppet::Type.type(:custom).provide :linux do
|
46
46
|
@doc = 'An example provider on Linux.'
|
47
47
|
end
|
48
|
-
SOURCE
|
48
|
+
SOURCE
|
49
49
|
}
|
50
50
|
|
51
51
|
it 'should correctly detect the docstring' do
|
@@ -62,7 +62,7 @@ Puppet::Type.type(:custom).provide :linux do
|
|
62
62
|
desc %Q{This is a multi-line
|
63
63
|
doc in %Q with #{test}}
|
64
64
|
end
|
65
|
-
SOURCE
|
65
|
+
SOURCE
|
66
66
|
}
|
67
67
|
|
68
68
|
it 'should strip the `%Q{}` and render the interpolation expression literally' do
|
@@ -84,7 +84,7 @@ Puppet::Type.type(:custom).provide :linux do
|
|
84
84
|
has_feature :some_other_feature
|
85
85
|
commands foo: '/usr/bin/foo'
|
86
86
|
end
|
87
|
-
SOURCE
|
87
|
+
SOURCE
|
88
88
|
}
|
89
89
|
|
90
90
|
it 'should register a provider object' do
|
@@ -106,13 +106,32 @@ SOURCE
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
describe 'parsing a provider definition with a string based name' do
|
110
|
+
let(:source) { <<-SOURCE
|
111
|
+
Puppet::Type.type(:'custom').provide :'linux' do
|
112
|
+
desc 'An example provider on Linux.'
|
113
|
+
end
|
114
|
+
SOURCE
|
115
|
+
}
|
116
|
+
|
117
|
+
it 'should register a provider object' do
|
118
|
+
expect(subject.size).to eq(1)
|
119
|
+
object = subject.first
|
120
|
+
expect(object).to be_a(PuppetStrings::Yard::CodeObjects::Provider)
|
121
|
+
expect(object.namespace).to eq(PuppetStrings::Yard::CodeObjects::Providers.instance('custom'))
|
122
|
+
expect(object.name).to eq(:linux)
|
123
|
+
expect(object.type_name).to eq('custom')
|
124
|
+
expect(object.docstring).to eq('An example provider on Linux.')
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
109
128
|
describe 'parsing a provider with a summary' do
|
110
129
|
context 'when the summary has fewer than 140 characters' do
|
111
130
|
let(:source) { <<-SOURCE
|
112
131
|
Puppet::Type.type(:custom).provide :linux do
|
113
132
|
@doc = '@summary A short summary.'
|
114
133
|
end
|
115
|
-
SOURCE
|
134
|
+
SOURCE
|
116
135
|
}
|
117
136
|
|
118
137
|
it 'should parse the summary' do
|
@@ -128,7 +147,7 @@ SOURCE
|
|
128
147
|
Puppet::Type.type(:custom).provide :linux do
|
129
148
|
@doc = '@summary A short summary that is WAY TOO LONG. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH this is not what a summary is for! It should be fewer than 140 characters!!'
|
130
149
|
end
|
131
|
-
SOURCE
|
150
|
+
SOURCE
|
132
151
|
}
|
133
152
|
|
134
153
|
it 'should log a warning' do
|
@@ -20,7 +20,7 @@ describe PuppetStrings::Yard::Handlers::Ruby::RsapiHandler do
|
|
20
20
|
Puppet::ResourceApi.register_type(
|
21
21
|
name: 'database'
|
22
22
|
)
|
23
|
-
SOURCE
|
23
|
+
SOURCE
|
24
24
|
}
|
25
25
|
|
26
26
|
it 'should log a warning' do
|
@@ -34,7 +34,7 @@ Puppet::ResourceApi.register_type(
|
|
34
34
|
name: 'database',
|
35
35
|
docs: 'An example database server resource type.',
|
36
36
|
)
|
37
|
-
SOURCE
|
37
|
+
SOURCE
|
38
38
|
}
|
39
39
|
|
40
40
|
it 'should correctly detect the docstring' do
|
@@ -53,7 +53,7 @@ Puppet::ResourceApi.register_type(
|
|
53
53
|
docs: %Q{This is a multi-line
|
54
54
|
doc in %Q with #{test}},
|
55
55
|
)
|
56
|
-
SOURCE
|
56
|
+
SOURCE
|
57
57
|
}
|
58
58
|
|
59
59
|
it 'should strip the `%Q{}` and render the interpolation expression literally' do
|
@@ -110,7 +110,7 @@ Puppet::ResourceApi.register_type(
|
|
110
110
|
},
|
111
111
|
},
|
112
112
|
)
|
113
|
-
SOURCE
|
113
|
+
SOURCE
|
114
114
|
}
|
115
115
|
|
116
116
|
it 'should register a type object' do
|
@@ -186,7 +186,7 @@ Puppet::ResourceApi.register_type(
|
|
186
186
|
name: 'database',
|
187
187
|
docs: '@summary A short summary.',
|
188
188
|
)
|
189
|
-
SOURCE
|
189
|
+
SOURCE
|
190
190
|
}
|
191
191
|
|
192
192
|
it 'should parse the summary' do
|
@@ -203,7 +203,7 @@ Puppet::ResourceApi.register_type(
|
|
203
203
|
name: 'database',
|
204
204
|
docs: '@summary A short summary that is WAY TOO LONG. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH this is not what a summary is for! It should be fewer than 140 characters!!',
|
205
205
|
)
|
206
|
-
SOURCE
|
206
|
+
SOURCE
|
207
207
|
}
|
208
208
|
|
209
209
|
it 'should log a warning' do
|
@@ -224,7 +224,7 @@ Puppet::ResourceApi.register_type(
|
|
224
224
|
}
|
225
225
|
]
|
226
226
|
)
|
227
|
-
SOURCE
|
227
|
+
SOURCE
|
228
228
|
}
|
229
229
|
|
230
230
|
it 'should not emit a warning' do
|
@@ -19,7 +19,7 @@ describe PuppetStrings::Yard::Handlers::Ruby::TypeHandler do
|
|
19
19
|
let(:source) { <<-SOURCE
|
20
20
|
Puppet::Type.newtype(:database) do
|
21
21
|
end
|
22
|
-
SOURCE
|
22
|
+
SOURCE
|
23
23
|
}
|
24
24
|
|
25
25
|
it 'should log a warning' do
|
@@ -32,7 +32,7 @@ SOURCE
|
|
32
32
|
Puppet::Type.newtype(:database) do
|
33
33
|
@doc = 123
|
34
34
|
end
|
35
|
-
SOURCE
|
35
|
+
SOURCE
|
36
36
|
}
|
37
37
|
|
38
38
|
it 'should log an error' do
|
@@ -45,7 +45,7 @@ SOURCE
|
|
45
45
|
Puppet::Type.newtype(:database) do
|
46
46
|
@doc = 'An example database server resource type.'
|
47
47
|
end
|
48
|
-
SOURCE
|
48
|
+
SOURCE
|
49
49
|
}
|
50
50
|
|
51
51
|
it 'should correctly detect the docstring' do
|
@@ -62,7 +62,7 @@ Puppet::Type.newtype(:database) do
|
|
62
62
|
desc %Q{This is a multi-line
|
63
63
|
doc in %Q with #{test}}
|
64
64
|
end
|
65
|
-
SOURCE
|
65
|
+
SOURCE
|
66
66
|
}
|
67
67
|
|
68
68
|
it 'should strip the `%Q{}` and render the interpolation expression literally' do
|
@@ -82,7 +82,7 @@ Puppet::Type.newtype(:database) do
|
|
82
82
|
defaultto false
|
83
83
|
end
|
84
84
|
end
|
85
|
-
SOURCE
|
85
|
+
SOURCE
|
86
86
|
}
|
87
87
|
|
88
88
|
it 'should correctly detect the required_feature' do
|
@@ -150,7 +150,7 @@ Puppet::Type.newtype(:database) do
|
|
150
150
|
defaultto 'warn'
|
151
151
|
end
|
152
152
|
end
|
153
|
-
SOURCE
|
153
|
+
SOURCE
|
154
154
|
}
|
155
155
|
|
156
156
|
it 'should register a type object' do
|
@@ -223,13 +223,29 @@ SOURCE
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
+
describe 'parsing a valid type with string based name' do
|
227
|
+
let(:source) { <<-SOURCE
|
228
|
+
Puppet::Type.newtype(:'database') do
|
229
|
+
desc 'An example database server resource type.'
|
230
|
+
ensurable
|
231
|
+
end
|
232
|
+
SOURCE
|
233
|
+
}
|
234
|
+
|
235
|
+
it 'should register a type object with default ensure values' do
|
236
|
+
expect(subject.size).to eq(1)
|
237
|
+
object = subject.first
|
238
|
+
expect(object.name).to eq(:database)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
226
242
|
describe 'parsing an ensurable type with default ensure values' do
|
227
243
|
let(:source) { <<-SOURCE
|
228
244
|
Puppet::Type.newtype(:database) do
|
229
245
|
desc 'An example database server resource type.'
|
230
246
|
ensurable
|
231
247
|
end
|
232
|
-
SOURCE
|
248
|
+
SOURCE
|
233
249
|
}
|
234
250
|
|
235
251
|
it 'should register a type object with default ensure values' do
|
@@ -250,7 +266,7 @@ Puppet::Type.newtype(:database) do
|
|
250
266
|
desc 'The database server name.'
|
251
267
|
end
|
252
268
|
end
|
253
|
-
SOURCE
|
269
|
+
SOURCE
|
254
270
|
}
|
255
271
|
|
256
272
|
it 'should register a type object with the "name" parameter as the namevar' do
|
@@ -268,7 +284,7 @@ SOURCE
|
|
268
284
|
Puppet::Type.newtype(:database) do
|
269
285
|
@doc = '@summary A short summary.'
|
270
286
|
end
|
271
|
-
SOURCE
|
287
|
+
SOURCE
|
272
288
|
}
|
273
289
|
|
274
290
|
it 'should parse the summary' do
|
@@ -284,7 +300,7 @@ SOURCE
|
|
284
300
|
Puppet::Type.newtype(:database) do
|
285
301
|
@doc = '@summary A short summary that is WAY TOO LONG. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH this is not what a summary is for! It should be fewer than 140 characters!!'
|
286
302
|
end
|
287
|
-
SOURCE
|
303
|
+
SOURCE
|
288
304
|
}
|
289
305
|
|
290
306
|
it 'should log a warning' do
|
@@ -24,7 +24,7 @@ describe PuppetStrings::Yard::Parsers::JSON::TaskStatement do
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
27
|
-
SOURCE
|
27
|
+
SOURCE
|
28
28
|
}
|
29
29
|
let(:json) { JSON.parse(source) }
|
30
30
|
subject { PuppetStrings::Yard::Parsers::JSON::TaskStatement.new(json, source, "test.json") }
|
@@ -45,7 +45,7 @@ SOURCE
|
|
45
45
|
"description": "Allows you to backup your database to local file.",
|
46
46
|
"input_method": "stdin"
|
47
47
|
}
|
48
|
-
SOURCE
|
48
|
+
SOURCE
|
49
49
|
}
|
50
50
|
it 'returns an empty hash' do
|
51
51
|
expect(subject.parameters).to eq({})
|