No commit activity in last 3 years
No release in over 3 years
ChefSpec Coverage Reports
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

>= 4.0
 Project Readme

ChefSpec::CoverageReports

Provides a generic interface to creating ChefSpec coverage reports, including a default JSON report.

Installation

Add this line to your application's Gemfile:

gem 'chefspec-coveragereports'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chefspec-coveragereports

Usage

To enable the Coverage Reports functionality, you must include the following inside of your spec_helper:

require 'chefspec/coveragereports'

With this included you can now tell the Coverage Reports what reports to generate and where to place the reports.

Using one of the included templates

To utilize one of the included Erubis templates you can use the following:

ChefSpec::CoverageReports.add('json', 'coverage.json')

This will utilize the built in json template, and create a file named coverage.json.

Proving your own template

To utilize your own Erubis template you can use the following:

ChefSpec::CoverageReports.add_custom('some/path/template.erb', 'coverage.report')

Where you provide the path to the template, and the output file for the report.

Template Functionality

Coverage Reports exposes a hash called @coverage that can be used to create your own custom Erubis templates.

This hash provides full access to the raw coverage data generated by ChefSpec, as well as some already processed data.

raw

	@coverage['raw']

Provides full access to the array of raw data generated by ChefSpec

coverage

	@coverage['coverage']

Provides acccess to the data processed by Coverage Reports.

files
	@coverage['coverage']['files']

Provides access to a hash of all of the files and the resources observed inside of them.

resources - all
	@coverage['coverage']['resources']['all']

Provides access to a hash of all of the resources, keyed by name.

resources - covered
	@coverage['coverage']['resources']['covered']

Provides access to a hash of all of the resources that were covered, keyed by name.

resources - uncovered
	@coverage['coverage']['resources']['uncovered']

Provides access to a hash of all of the resources that were not covered, keyed by name.

totals
	@coverage['coverage']['totals']

Provides a set of totals to help make reporting easier, including total resources, covered and uncovered resource counts, as well as percent coverage.

Contributing

  1. Fork it ( https://github.com/aspring/chefspec-reports/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request