puppet-strings 2.1.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -4
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +13 -4
  6. data/lib/puppet-strings/describe.rb +68 -0
  7. data/lib/puppet-strings/json.rb +2 -38
  8. data/lib/puppet-strings/markdown.rb +3 -1
  9. data/lib/puppet-strings/markdown/base.rb +37 -16
  10. data/lib/puppet-strings/markdown/data_type.rb +34 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  12. data/lib/puppet-strings/markdown/function.rb +2 -2
  13. data/lib/puppet-strings/markdown/resource_type.rb +19 -2
  14. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  15. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +12 -4
  16. data/lib/puppet-strings/markdown/templates/data_type.erb +93 -0
  17. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  18. data/lib/puppet-strings/markdown/templates/function.erb +36 -1
  19. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  20. data/lib/puppet-strings/markdown/templates/resource_type.erb +32 -12
  21. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  22. data/lib/puppet-strings/tasks/generate.rb +10 -3
  23. data/lib/puppet-strings/version.rb +1 -1
  24. data/lib/puppet-strings/yard.rb +16 -0
  25. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  26. data/lib/puppet-strings/yard/code_objects/class.rb +2 -2
  27. data/lib/puppet-strings/yard/code_objects/data_type.rb +100 -0
  28. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  29. data/lib/puppet-strings/yard/code_objects/defined_type.rb +2 -2
  30. data/lib/puppet-strings/yard/code_objects/function.rb +4 -4
  31. data/lib/puppet-strings/yard/code_objects/plan.rb +2 -2
  32. data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
  33. data/lib/puppet-strings/yard/code_objects/task.rb +1 -1
  34. data/lib/puppet-strings/yard/code_objects/type.rb +48 -6
  35. data/lib/puppet-strings/yard/handlers.rb +3 -0
  36. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  37. data/lib/puppet-strings/yard/handlers/ruby/base.rb +12 -1
  38. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +393 -0
  39. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +2 -12
  40. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
  41. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +3 -3
  42. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +135 -0
  43. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
  44. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +9 -115
  45. data/lib/puppet-strings/yard/parsers/json/parser.rb +4 -2
  46. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  47. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  48. data/lib/puppet-strings/yard/tags.rb +2 -0
  49. data/lib/puppet-strings/yard/tags/enum_tag.rb +12 -0
  50. data/lib/puppet-strings/yard/tags/factory.rb +16 -0
  51. data/lib/puppet-strings/yard/tags/overload_tag.rb +2 -2
  52. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  53. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  54. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  55. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  56. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  75. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  77. data/lib/puppet-strings/yard/util.rb +48 -0
  78. data/lib/puppet/face/strings.rb +68 -3
  79. metadata +36 -45
  80. data/Gemfile +0 -37
  81. data/HISTORY.md +0 -218
  82. data/JSON.md +0 -802
  83. data/Rakefile +0 -93
  84. data/codecov.yml +0 -3
  85. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  88. data/spec/acceptance/lib/util.rb +0 -163
  89. data/spec/acceptance/running_strings_generate.rb +0 -54
  90. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  91. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  92. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  93. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  94. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  95. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  96. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  97. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  98. data/spec/fixtures/unit/json/output.json +0 -660
  99. data/spec/fixtures/unit/json/output_with_plan.json +0 -697
  100. data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
  101. data/spec/fixtures/unit/markdown/output.md +0 -444
  102. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -478
  103. data/spec/spec_helper.rb +0 -45
  104. data/spec/spec_helper_acceptance.rb +0 -28
  105. data/spec/unit/puppet-strings/json_spec.rb +0 -229
  106. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  107. data/spec/unit/puppet-strings/markdown_spec.rb +0 -283
  108. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  109. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -124
  110. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  111. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  112. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  113. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  114. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  115. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -214
  116. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -269
  117. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -70
  118. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  119. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  120. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
@@ -1,45 +0,0 @@
1
- if ENV['COVERAGE'] == 'yes'
2
- require 'simplecov'
3
- require 'simplecov-console'
4
- require 'codecov'
5
-
6
- SimpleCov.formatters = [
7
- SimpleCov::Formatter::HTMLFormatter,
8
- SimpleCov::Formatter::Console,
9
- SimpleCov::Formatter::Codecov,
10
- ]
11
- SimpleCov.start do
12
- track_files 'lib/**/*.rb'
13
-
14
- add_filter '/spec'
15
- end
16
- end
17
-
18
- require 'mocha'
19
- require 'rspec'
20
- require 'puppet/version'
21
- require 'puppet-strings'
22
- require 'puppet-strings/markdown'
23
- require 'puppet-strings/markdown/base'
24
- require 'puppet-strings/yard'
25
-
26
- # Explicitly set up YARD once
27
- PuppetStrings::Yard.setup!
28
-
29
- # Enable testing of Puppet functions if running against 4.1+
30
- TEST_PUPPET_FUNCTIONS = Puppet::Util::Package.versioncmp(Puppet.version, "4.1.0") >= 0
31
-
32
- # Enable testing of Puppet language functions declared with return type if running against 4.8+
33
- TEST_FUNCTION_RETURN_TYPE = Puppet::Util::Package.versioncmp(Puppet.version, "4.8.0") >= 0
34
-
35
- # Enable testing of Plans if Puppet version is greater than 5.0.0
36
- TEST_PUPPET_PLANS = Puppet::Util::Package.versioncmp(Puppet.version, "5.0.0") >= 0
37
-
38
- RSpec.configure do |config|
39
- config.mock_with :mocha
40
-
41
- config.before(:each) do
42
- # Always clear the YARD registry before each example
43
- YARD::Registry.clear
44
- end
45
- end
@@ -1,28 +0,0 @@
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'
5
-
6
- unless ENV['RS_PROVISION'] == 'no'
7
- install_puppet
8
- end
9
-
10
- RSpec.configure do |c|
11
- # Readable test descriptions
12
- c.formatter = :documentation
13
-
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"
23
-
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
27
- end
28
- end
@@ -1,229 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet-strings/json'
3
- require 'tempfile'
4
-
5
- describe PuppetStrings::Json do
6
- before :each do
7
- # Populate the YARD registry with both Puppet and Ruby source
8
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
9
- # A simple class.
10
- # @todo Do a thing
11
- # @note Some note
12
- # @param param1 First param.
13
- # @param param2 Second param.
14
- # @param param3 Third param.
15
- class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
16
- }
17
-
18
- # A simple defined type.
19
- # @param param1 First param.
20
- # @param param2 Second param.
21
- # @param param3 Third param.
22
- define dt(Integer $param1, $param2, String $param3 = hi) {
23
- }
24
- SOURCE
25
-
26
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_PLANS
27
- # A simple plan.
28
- # @param param1 First param.
29
- # @param param2 Second param.
30
- # @param param3 Third param.
31
- plan plann(String $param1, $param2, Integer $param3 = 1) {
32
- }
33
- SOURCE
34
-
35
- # Only include Puppet functions for 4.1+
36
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet) if TEST_PUPPET_FUNCTIONS
37
- # A simple function.
38
- # @param param1 First param.
39
- # @param param2 Second param.
40
- # @param param3 Third param.
41
- # @return [Undef] Returns nothing.
42
- function func(Integer $param1, $param2, String $param3 = hi) {
43
- }
44
- SOURCE
45
-
46
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :json)
47
- {
48
- "description": "Allows you to backup your database to local file.",
49
- "input_method": "stdin",
50
- "parameters": {
51
- "database": {
52
- "description": "Database to connect to",
53
- "type": "Optional[String[1]]"
54
- },
55
- "user": {
56
- "description": "The user",
57
- "type": "Optional[String[1]]"
58
- },
59
- "password": {
60
- "description": "The password",
61
- "type": "Optional[String[1]]"
62
- },
63
- "sql": {
64
- "description": "Path to file you want backup to",
65
- "type": "String[1]"
66
- }
67
- }
68
- }
69
- SOURCE
70
-
71
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
72
- Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC
73
- An example 3.x function.
74
- @param [String] first The first parameter.
75
- @param second The second parameter.
76
- @return [Undef] Returns nothing.
77
- DOC
78
- ) do |*args|
79
- end
80
-
81
- # An example 4.x function.
82
- Puppet::Functions.create_function(:func4x) do
83
- # The first overload.
84
- # @param param1 The first parameter.
85
- # @param param2 The second parameter.
86
- # @param param3 The third parameter.
87
- # @return Returns nothing.
88
- dispatch :foo do
89
- param 'Integer', :param1
90
- param 'Any', :param2
91
- optional_param 'Array[String]', :param3
92
- return_type 'Undef'
93
- end
94
-
95
- # @param param The first parameter.
96
- # @param block The block parameter.
97
- # @return Returns a string.
98
- dispatch :other do
99
- param 'Boolean', :param
100
- block_param
101
- return_type 'String'
102
- end
103
- end
104
-
105
- # An example 4.x function with only one signature.
106
- Puppet::Functions.create_function(:func4x_1) do
107
- # @param param1 The first parameter.
108
- # @return [Undef] Returns nothing.
109
- dispatch :foobarbaz do
110
- param 'Integer', :param1
111
- end
112
- end
113
-
114
- Puppet::Type.type(:database).provide :linux do
115
- desc 'An example provider on Linux.'
116
- confine kernel: 'Linux'
117
- confine osfamily: 'RedHat'
118
- defaultfor :kernel => 'Linux'
119
- defaultfor :osfamily => 'RedHat', :operatingsystemmajrelease => '7'
120
- has_feature :implements_some_feature
121
- has_feature :some_other_feature
122
- commands foo: '/usr/bin/foo'
123
- end
124
-
125
- Puppet::Type.newtype(:database) do
126
- desc 'An example database server resource type.'
127
- feature :encryption, 'The provider supports encryption.', methods: [:encrypt]
128
- ensurable do
129
- desc 'What state the database should be in.'
130
- defaultvalues
131
- aliasvalue(:up, :present)
132
- aliasvalue(:down, :absent)
133
- defaultto :up
134
- end
135
-
136
- newparam(:address) do
137
- isnamevar
138
- desc 'The database server name.'
139
- end
140
-
141
- newparam(:encryption_key, required_features: :encryption) do
142
- desc 'The encryption key to use.'
143
- end
144
-
145
- newparam(:encrypt, :parent => Puppet::Parameter::Boolean) do
146
- desc 'Whether or not to encrypt the database.'
147
- defaultto false
148
- end
149
-
150
- newproperty(:file) do
151
- desc 'The database file to use.'
152
- end
153
-
154
- newproperty(:log_level) do
155
- desc 'The log level to use.'
156
- newvalue(:debug)
157
- newvalue(:warn)
158
- newvalue(:error)
159
- defaultto 'warn'
160
- end
161
- end
162
-
163
- Puppet::ResourceApi.register_type(
164
- name: 'apt_key',
165
- docs: <<-EOS,
166
- @summary Example resource type using the new API.
167
- @raise SomeError
168
- This type provides Puppet with the capabilities to manage GPG keys needed
169
- by apt to perform package validation. Apt has it's own GPG keyring that can
170
- be manipulated through the `apt-key` command.
171
- @example here's an example
172
- apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
173
- source => 'http://apt.puppetlabs.com/pubkey.gpg'
174
- }
175
-
176
- **Autorequires**:
177
- If Puppet is given the location of a key file which looks like an absolute
178
- path this type will autorequire that file.
179
- EOS
180
- attributes: {
181
- ensure: {
182
- type: 'Enum[present, absent]',
183
- desc: 'Whether this apt key should be present or absent on the target system.'
184
- },
185
- id: {
186
- type: 'Variant[Pattern[/\A(0x)?[0-9a-fA-F]{8}\Z/], Pattern[/\A(0x)?[0-9a-fA-F]{16}\Z/], Pattern[/\A(0x)?[0-9a-fA-F]{40}\Z/]]',
187
- behaviour: :namevar,
188
- desc: 'The ID of the key you want to manage.',
189
- },
190
- # ...
191
- created: {
192
- type: 'String',
193
- behaviour: :read_only,
194
- desc: 'Date the key was created, in ISO format.',
195
- },
196
- },
197
- autorequires: {
198
- file: '$source', # will evaluate to the value of the `source` attribute
199
- package: 'apt',
200
- },
201
- )
202
- SOURCE
203
- end
204
-
205
- let(:filename) do
206
- if TEST_PUPPET_PLANS
207
- 'output_with_plan.json'
208
- else
209
- TEST_PUPPET_FUNCTIONS ? 'output.json' : 'output_without_puppet_function.json'
210
- end
211
- end
212
- let(:baseline_path) { File.join(File.dirname(__FILE__), "../../fixtures/unit/json/#{filename}") }
213
- let(:baseline) { File.read(baseline_path) }
214
-
215
- describe 'rendering JSON to a file' do
216
- it 'should output the expected JSON content' do
217
- Tempfile.open('json') do |file|
218
- PuppetStrings::Json.render(file.path)
219
- expect(File.read(file.path)).to eq(baseline)
220
- end
221
- end
222
- end
223
-
224
- describe 'rendering JSON to stdout' do
225
- it 'should output the expected JSON content' do
226
- expect{ PuppetStrings::Json.render(nil) }.to output(baseline).to_stdout
227
- end
228
- end
229
- end
@@ -1,146 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PuppetStrings::Markdown::Base do
4
- context 'basic class' do
5
- before :each do
6
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
7
- # An overview
8
- # @api private
9
- # @summary A simple class.
10
- # @param param1 First param.
11
- # @param param2 Second param.
12
- # @param param3 Third param.
13
- class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
14
- }
15
- SOURCE
16
- end
17
-
18
- let(:reg) { YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash)[0] }
19
- let(:component) { PuppetStrings::Markdown::Base.new(reg, 'class') }
20
-
21
- describe '#name' do
22
- it 'returns the expected name' do
23
- expect(component.name).to eq 'klass'
24
- end
25
- end
26
-
27
- [ 'examples',
28
- 'see',
29
- 'since',
30
- 'return_val',
31
- 'return_type',].each do |method|
32
- describe "##{method}" do
33
- it 'returns nil' do
34
- expect(component.method(method.to_sym).call).to be_nil
35
- end
36
- end
37
-
38
- end
39
-
40
- describe '#private?' do
41
- it do
42
- expect(component.private?).to be true
43
- end
44
- end
45
-
46
- describe '#params' do
47
- it 'returns the expected params' do
48
- expect(component.params.size).to eq 3
49
- end
50
- end
51
-
52
- describe '#summary' do
53
- it 'returns the expected summary' do
54
- expect(component.summary).to eq 'A simple class.'
55
- end
56
- end
57
-
58
- describe '#toc_info' do
59
- let(:toc) { component.toc_info }
60
- it 'returns a hash' do
61
- expect(toc).to be_instance_of Hash
62
- end
63
- it 'prefers the summary for :desc' do
64
- expect(toc[:desc]).to eq 'A simple class.'
65
- end
66
- end
67
- end
68
- context 'less basic class' do
69
- before :each do
70
- YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
71
- # An overview
72
- # It's a longer overview
73
- # Ya know?
74
- # @example A simple example.
75
- # class { 'klass::yeah':
76
- # param1 => 1,
77
- # }
78
- # @param param1 First param.
79
- # @param param2 Second param.
80
- # @param param3 Third param.
81
- class klass::yeah(
82
- Integer $param1,
83
- $param2,
84
- String $param3 = hi
85
- ) inherits foo::bar {
86
-
87
- }
88
- SOURCE
89
- end
90
-
91
- let(:reg) { YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash)[0] }
92
- let(:component) { PuppetStrings::Markdown::Base.new(reg, 'class') }
93
-
94
- describe '#name' do
95
- it 'returns the expected name' do
96
- expect(component.name).to eq 'klass::yeah'
97
- end
98
- end
99
-
100
- ['summary',
101
- 'see',
102
- 'since',
103
- 'return_val',
104
- 'return_type'].each do |method|
105
- describe "##{method}" do
106
- it 'returns nil' do
107
- expect(component.method(method.to_sym).call).to be_nil
108
- end
109
- end
110
- end
111
-
112
- describe '#examples' do
113
- it 'should return one example' do
114
- expect(component.examples.size).to eq 1
115
- end
116
- end
117
-
118
- describe '#params' do
119
- it 'returns the expected params' do
120
- expect(component.params.size).to eq 3
121
- end
122
- end
123
-
124
- describe '#private?' do
125
- it do
126
- expect(component.private?).to be false
127
- end
128
- end
129
-
130
- describe '#toc_info' do
131
- let(:toc) { component.toc_info }
132
- it 'returns a hash' do
133
- expect(toc).to be_instance_of Hash
134
- end
135
- it 'uses overview for :desc in absence of summary' do
136
- expect(toc[:desc]).to eq 'An overview It\'s a longer overview Ya know?'
137
- end
138
- end
139
-
140
- describe '#link' do
141
- it 'returns a valid link' do
142
- expect(component.link).to eq 'klassyeah'
143
- end
144
- end
145
- end
146
- end