forked from puppetlabs/puppetlabs-inifile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request puppetlabs#330 from tphoney/MODULES-3958
(MODULES-3958) enable rspec-mock and code coverage
- Loading branch information
Showing
5 changed files
with
54 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
RSpec.configure do |config| | ||
config.mock_with :rspec | ||
if ENV['COVERAGE'] == 'yes' | ||
require 'simplecov' | ||
require 'simplecov-console' | ||
require 'codecov' | ||
|
||
SimpleCov.formatters = [ | ||
SimpleCov::Formatter::HTMLFormatter, | ||
SimpleCov::Formatter::Console, | ||
SimpleCov::Formatter::Codecov, | ||
] | ||
SimpleCov.start do | ||
track_files 'lib/**/*.rb' | ||
|
||
add_filter '/spec' | ||
|
||
# do not track vendored files | ||
add_filter '/vendor' | ||
add_filter '/.vendor' | ||
|
||
# do not track gitignored files | ||
# this adds about 4 seconds to the coverage check | ||
# this could definitely be optimized | ||
add_filter do |f| | ||
# system returns true if exit status is 0, which with git-check-ignore means file is ignored | ||
system("git check-ignore --quiet #{f.filename}") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters