Merge pull request #112 from whopper/PDOC-127/master/scrub-feature-docstrings
(PDOC-127) Strip whitespace from type feature docstrings
This commit is contained in:
commit
8e911af5a9
|
@ -78,7 +78,7 @@ class PuppetStrings::Yard::CodeObjects::Type < PuppetStrings::Yard::CodeObjects:
|
||||||
# @param [String] docstring The docstring of the feature.
|
# @param [String] docstring The docstring of the feature.
|
||||||
def initialize(name, docstring)
|
def initialize(name, docstring)
|
||||||
@name = name
|
@name = name
|
||||||
@docstring = docstring
|
@docstring = Puppet::Util::Docs.scrub(docstring).gsub("\n", ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Converts the feature to a hash representation.
|
# Converts the feature to a hash representation.
|
||||||
|
|
|
@ -62,6 +62,11 @@ SOURCE
|
||||||
Puppet::Type.newtype(:database) do
|
Puppet::Type.newtype(:database) do
|
||||||
desc 'An example database server resource type.'
|
desc 'An example database server resource type.'
|
||||||
feature :encryption, 'The provider supports encryption.', methods: [:encrypt]
|
feature :encryption, 'The provider supports encryption.', methods: [:encrypt]
|
||||||
|
|
||||||
|
feature :magic,
|
||||||
|
'The feature docstring should have
|
||||||
|
whitespace and newlines stripped out.'
|
||||||
|
|
||||||
ensurable do
|
ensurable do
|
||||||
desc 'What state the database should be in.'
|
desc 'What state the database should be in.'
|
||||||
defaultvalues
|
defaultvalues
|
||||||
|
@ -167,9 +172,11 @@ SOURCE
|
||||||
expect(object.parameters[4].isnamevar).to eq(false)
|
expect(object.parameters[4].isnamevar).to eq(false)
|
||||||
expect(object.parameters[4].default).to eq('never')
|
expect(object.parameters[4].default).to eq('never')
|
||||||
expect(object.parameters[4].values).to eq(%w(daily monthly never))
|
expect(object.parameters[4].values).to eq(%w(daily monthly never))
|
||||||
expect(object.features.size).to eq(1)
|
expect(object.features.size).to eq(2)
|
||||||
expect(object.features[0].name).to eq('encryption')
|
expect(object.features[0].name).to eq('encryption')
|
||||||
expect(object.features[0].docstring).to eq('The provider supports encryption.')
|
expect(object.features[0].docstring).to eq('The provider supports encryption.')
|
||||||
|
expect(object.features[1].name).to eq('magic')
|
||||||
|
expect(object.features[1].docstring).to eq('The feature docstring should have whitespace and newlines stripped out.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue