chefspec 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chefspec/coverage.rb +20 -0
- data/lib/chefspec/version.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/templates/coverage/human.erb +22 -0
- data/templates/coverage/json.erb +8 -0
- data/templates/coverage/table.erb +14 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74bb24c63b0385dccb22c7a83abcd2350429986bd6de6f1444df2d548d8bb72b
|
4
|
+
data.tar.gz: a66b22b4e3f705eea2d2d11fc65e9285cb890aa00f76ab826b47b66d37497678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77dd4b42946b4bf2129dba71039fee03a5c1cebf8c9b2026ae4c7b31e443dea9a9a579e78d7b36ba89d75562a6eeaf9d1a701052a143cd2cc26914e15f64a4f7
|
7
|
+
data.tar.gz: 4471c363638234ee7e5268db4de027b1d0b749c7ae74eaa9343c0a3f35db9b9ce0eb2c97e6b8a8c57efad75fe3b7500c34c7218a040716dfcf8cd1cba60dc6c8
|
data/lib/chefspec/coverage.rb
CHANGED
@@ -90,6 +90,26 @@ module ChefSpec
|
|
90
90
|
@outputs << block
|
91
91
|
end
|
92
92
|
|
93
|
+
#
|
94
|
+
# Change the template for reporting of converage analysis.
|
95
|
+
#
|
96
|
+
# @param [string] path
|
97
|
+
# The template file to use for the output of the report
|
98
|
+
#
|
99
|
+
# @return [true]
|
100
|
+
#
|
101
|
+
def set_template(file = 'human.erb')
|
102
|
+
[
|
103
|
+
ChefSpec.root.join('templates', 'coverage', file),
|
104
|
+
File.expand_path(file, Dir.pwd)
|
105
|
+
].each do |temp|
|
106
|
+
if File.exist?(temp)
|
107
|
+
@template = temp
|
108
|
+
return
|
109
|
+
end
|
110
|
+
end
|
111
|
+
raise Error::TemplateNotFound.new(path: file)
|
112
|
+
end
|
93
113
|
#
|
94
114
|
# Add a resource to the resource collection. Only new resources are added
|
95
115
|
# and only resources that match the given filter are covered (which is *
|
data/lib/chefspec/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
<% if @total == 0 %>
|
3
|
+
No Chef resources found, skipping coverage calculation...
|
4
|
+
<% else %>
|
5
|
+
ChefSpec Coverage report generated...
|
6
|
+
|
7
|
+
Total Resources: <%= @total %>
|
8
|
+
Touched Resources: <%= @touched %>
|
9
|
+
Touch Coverage: <%= @coverage %>%
|
10
|
+
|
11
|
+
<% if @untouched_resources.empty? %>
|
12
|
+
You are awesome and so is your test coverage! Have a fantastic day!
|
13
|
+
|
14
|
+
<% else %>
|
15
|
+
Untouched Resources:
|
16
|
+
|
17
|
+
<% @untouched_resources.each do |resource| %>
|
18
|
+
<%= resource.to_s.ljust(32) %> <%= resource.source_file %>:<%= resource.source_line %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%='Touched'.to_s.ljust(8) %> <%='Resource'.to_s.ljust(48) %> File:Line
|
2
|
+
<% @all_resources.each do |resource| %>
|
3
|
+
<%=resource.touched?.to_s.ljust(8) %> <%= resource.to_s.ljust(48) %> <%= resource.source_file %>:<%= resource.source_line %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% if @total == 0 %>
|
7
|
+
No Chef resources found, skipping coverage calculation...
|
8
|
+
<% else %>
|
9
|
+
ChefSpec Coverage report generated...
|
10
|
+
|
11
|
+
Total Resources: <%= @total %>
|
12
|
+
Touched Resources: <%= @touched %>
|
13
|
+
Touch Coverage: <%= @coverage %>%
|
14
|
+
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -181,6 +181,9 @@ files:
|
|
181
181
|
- spec/unit/stubs/search_registry_spec.rb
|
182
182
|
- spec/unit/stubs/search_stub_spec.rb
|
183
183
|
- spec/unit/stubs/stub_spec.rb
|
184
|
+
- templates/coverage/human.erb
|
185
|
+
- templates/coverage/json.erb
|
186
|
+
- templates/coverage/table.erb
|
184
187
|
- templates/errors/cookbook_path_not_found.erb
|
185
188
|
- templates/errors/erb_template_parse_error.erb
|
186
189
|
- templates/errors/gem_load_error.erb
|