(PDOC-223) revert rsapi changes and remove markdown test

First, there were some rspec problems we originally connected to directory naming (e.g. 'yard'), but now we think it's a possible bug in rspec (https://github.com/rspec/rspec-core/issues/2184). this removes the markdown_spec.rb test that was both triggering the bug and, as it turns out, is an unnecessary test.

Reverted some of the changes made to the rsapi handler during markdown
output work. Those changes were made because of a typo in the spec
tests, so the typo has been fixed and most of the handler returned to
its original state.
This commit is contained in:
Eric Putnam 2018-03-19 15:52:45 -07:00
parent 2a5d23f82b
commit be444fa6ad
No known key found for this signature in database
GPG Key ID: 3FB595AA224A7751
8 changed files with 14 additions and 20 deletions

View File

@ -23,4 +23,4 @@ matrix:
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
script: 'SPEC_OPTS="--format documentation" COVERAGE="yes" bundle exec rspec spec/unit/puppet-strings/*/*'
script: 'SPEC_OPTS="--format documentation" COVERAGE="yes" bundle exec rake $CHECK'

View File

@ -24,7 +24,7 @@ class PuppetStrings::Yard::Handlers::Ruby::RsapiHandler < PuppetStrings::Yard::H
object = PuppetStrings::Yard::CodeObjects::Type.new(schema['name'])
register object
docstring = schema['desc'] || ""
docstring = schema['docs']
if docstring
register_docstring(object, PuppetStrings::Yard::Util.scrub_string(docstring.to_s), nil)
else

View File

@ -126,7 +126,7 @@ 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

View File

@ -187,7 +187,7 @@ 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
@ -239,10 +239,4 @@ SOURCE
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

View File

@ -19,7 +19,7 @@ describe PuppetStrings::Yard::Handlers::Puppet::ClassHandler do
let(:source) { 'class foo{' }
it 'should log an error' do
expect{ subject }.to output(/\[error\]: Failed to parse \(stdin\): Syntax error at end of input/).to_stdout_from_any_process
expect{ subject }.to output(/\[error\]: Failed to parse \(stdin\): Syntax error at end of (file|input)/).to_stdout_from_any_process
expect(subject.empty?).to eq(true)
end
end

View File

@ -19,7 +19,7 @@ describe PuppetStrings::Yard::Handlers::Puppet::DefinedTypeHandler do
let(:source) { 'define foo{' }
it 'should log an error' do
expect{ subject }.to output(/\[error\]: Failed to parse \(stdin\): Syntax error at end of input/).to_stdout_from_any_process
expect{ subject }.to output(/\[error\]: Failed to parse \(stdin\): Syntax error at end of (file|input)/).to_stdout_from_any_process
expect(subject.empty?).to eq(true)
end
end

View File

@ -133,19 +133,19 @@ SOURCE
expect(object.properties[1].docstring).to eq('What state the database should be in.')
expect(object.properties[1].isnamevar).to eq(false)
expect(object.properties[1].default).to eq('up')
expect(object.properties[1].values).to eq(['Enum[present, absent, up, down]'])
expect(object.properties[1].data_type).to eq('Enum[present, absent, up, down]')
expect(object.properties[1].aliases).to eq({})
expect(object.properties[2].name).to eq('file')
expect(object.properties[2].docstring).to eq('The database file to use.')
expect(object.properties[2].isnamevar).to eq(false)
expect(object.properties[2].default).to be_nil
expect(object.properties[2].values).to eq(['String'])
expect(object.properties[2].data_type).to eq('String')
expect(object.properties[2].aliases).to eq({})
expect(object.properties[3].name).to eq('log_level')
expect(object.properties[3].docstring).to eq('The log level to use.')
expect(object.properties[3].isnamevar).to eq(false)
expect(object.properties[3].default).to eq('warn')
expect(object.properties[3].values).to eq(['Enum[debug, warn, error]'])
expect(object.properties[3].data_type).to eq('Enum[debug, warn, error]')
expect(object.properties[3].aliases).to eq({})
expect(object.parameters.size).to eq(5)
expect(object.parameters[0].name).to eq('dynamic_param')
@ -156,25 +156,25 @@ SOURCE
expect(object.parameters[1].docstring).to eq('The database server name.')
expect(object.parameters[1].isnamevar).to eq(true)
expect(object.parameters[1].default).to be_nil
expect(object.parameters[1].values).to eq(['String'])
expect(object.parameters[1].data_type).to eq('String')
expect(object.parameters[1].aliases).to eq({})
expect(object.parameters[2].name).to eq('encrypt')
expect(object.parameters[2].docstring).to eq('Whether or not to encrypt the database.')
expect(object.parameters[2].isnamevar).to eq(false)
expect(object.parameters[2].default).to eq(false)
expect(object.parameters[2].values).to eq(["Boolean"])
expect(object.parameters[2].data_type).to eq("Boolean")
expect(object.parameters[2].aliases).to eq({})
expect(object.parameters[3].name).to eq('encryption_key')
expect(object.parameters[3].docstring).to eq('The encryption key to use.')
expect(object.parameters[3].isnamevar).to eq(false)
expect(object.parameters[3].default).to be_nil
expect(object.parameters[3].values).to eq(["Optional[String]"])
expect(object.parameters[3].data_type).to eq("Optional[String]")
expect(object.parameters[3].aliases).to eq({})
expect(object.parameters[4].name).to eq('backup')
expect(object.parameters[4].docstring).to eq('How often to backup the database.')
expect(object.parameters[4].isnamevar).to eq(false)
expect(object.parameters[4].default).to eq('never')
expect(object.parameters[4].values).to eq(["Enum[daily, monthly, never]"])
expect(object.parameters[4].data_type).to eq("Enum[daily, monthly, never]")
end
end

View File

@ -29,7 +29,7 @@ SOURCE
}
it 'should raise an exception' do
expect{ subject.parse }.to output(/\[error\]: Failed to parse test.pp: Syntax error at end of input/).to_stdout_from_any_process
expect{ subject.parse }.to output(/\[error\]: Failed to parse test.pp: Syntax error at end of (file|input)/).to_stdout_from_any_process
end
end