Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options for rspec-puppet coverage reports #174

Merged
merged 1 commit into from Jan 23, 2019

Conversation

genebean
Copy link
Contributor

@genebean genebean commented Jan 3, 2019

Two options are added:

  • coverage_report: Defaults to false
  • minimum_code_coverage_percentage: Defaults to 0

Wasn't sure how to test this since all the things I could find for using a custom template only allowed pulling from master...

@genebean
Copy link
Contributor Author

genebean commented Jan 3, 2019

This is an alternative to #149

@genebean
Copy link
Contributor Author

genebean commented Jan 8, 2019

I created https://tickets.puppetlabs.com/browse/PDK-1249 to document the inability to test this.

README.md Outdated
@@ -168,6 +168,8 @@ Travis uses a .travis.yml file in the root of your repository to learn about you
|mock_with|Defaults to `':mocha'`. Recommended to be set to `':rspec'`, which uses RSpec's built-in mocking library, instead of a third-party one.|
|spec_overrides|An array of extra lines to add into your `spec_helper.rb`. Can be used as an alternative to `spec_helper_local`|
|strict_level| Defines the [Puppet Strict configuration parameter](https://puppet.com/docs/puppet/5.4/configuration.html#strict). Defaults to `:warning`. Other values are: `:error` and `:off`. `:error` provides strictest level checking and is encouraged.|
|enable_coverage_reports|Enable [rspec-puppet coverage reports](https://rspec-puppet.com/documentation/coverage/). Defaults to `false`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but since it will be a public option I prefer thecoverage_report option name from #149 , especially with it being a boolean value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do, will push a fix for that

@@ -43,6 +43,11 @@ RSpec.configure do |c|
Puppet.settings[:strict] = <%= @configs['strict_level'] %>
end
<%- end -%>
c.after(:suite) do
<%- if @configs['enable_coverage_reports'] -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the conditional should wrap the entire c.after(:suite) block, so that it's not an empty block if coverage_report is false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it inside the block since an empty block shouldn't hurt anything and this sets the file up for others adding additional things to this block. If it wraps the entire thing then the next contributor would have to adjust this code too. If you feel strongly about it I will change it though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just a stylistic nit, since the rendered file could potentially have an empty block, which isn't a big deal. No change necessary.

README.md Outdated Show resolved Hide resolved
@genebean genebean force-pushed the code_coverage_reports branch 2 times, most recently from a5976be to 7342405 Compare January 23, 2019 15:00
@genebean
Copy link
Contributor Author

Rebased to resolve merge conflict

Two options are added:
- coverage_report: Defaults to false
- minimum_code_coverage_percentage: Defaults to 0
@bmjen bmjen merged commit 7281db5 into puppetlabs:master Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants