chefspec 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +10 -0
- data/README.md +81 -19
- data/examples/stub_data_bag/spec/default_spec.rb +2 -2
- data/lib/chefspec/berkshelf.rb +7 -2
- data/lib/chefspec/coverage.rb +87 -12
- data/lib/chefspec/coverage/filters.rb +61 -0
- data/lib/chefspec/expect_exception.rb +9 -3
- data/lib/chefspec/macros.rb +4 -1
- data/lib/chefspec/version.rb +1 -1
- data/spec/unit/expect_exception_spec.rb +2 -2
- metadata +28 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feb37fa56e514030940a63b574f753750fd7e626
|
4
|
+
data.tar.gz: 46581585e0fcf5ab806dfe1dfc2f69d5f69fc3f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 763646749b05eda88a493d55181a7ee2586298eeeb092ad33f222ff50ab7c6839351ab9d0c5da5254374b0a223c08cc07efc48565b063afd09bfd57d9b782930
|
7
|
+
data.tar.gz: 8034fd1aa4818e79f8cbc6e549a2d4d60dd0cbc734e1877bf0d3a19f2a690144594f0faa5ca64f3845cb9bce58817051139351ec624e18341b356268866732cd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
CHANGELOG for ChefSpec
|
2
2
|
======================
|
3
3
|
|
4
|
+
## 3.3.0 (March 9, 2014)
|
5
|
+
Bugfixes:
|
6
|
+
- Update documentation for setting `automatic` attributes
|
7
|
+
- Update documentation for stubbing data_bags
|
8
|
+
- Use a non-internal RSpec variable name for expecting exceptions
|
9
|
+
- Fix the airity of the `stub_node` method
|
10
|
+
|
11
|
+
Improvements:
|
12
|
+
- Better filtering protocols for resource coverage
|
13
|
+
|
4
14
|
## 3.2.0 (January 31, 2014)
|
5
15
|
Bugfixes:
|
6
16
|
- Fix coverage calculation when there are no resources in the collection
|
data/README.md
CHANGED
@@ -304,6 +304,19 @@ describe 'example::default' do
|
|
304
304
|
end
|
305
305
|
```
|
306
306
|
|
307
|
+
### Automatic attributes
|
308
|
+
ChefSpec provides mocked automatic Ohai data using [fauxhai](https://github.com/customink/fauxhai). To mock out `automatic` attributes, you must use the `automatic` key:
|
309
|
+
|
310
|
+
```ruby
|
311
|
+
describe 'example::default' do
|
312
|
+
let(:chef_run) do
|
313
|
+
ChefSpec::Runner.new do |node|
|
314
|
+
node.automatic['memory']['total'] = '512kB'
|
315
|
+
end.converge(described_recipe)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
```
|
319
|
+
|
307
320
|
The `node` that is returned is actually a [`Chef::Node`](http://docs.opscode.com/essentials_node_object.html) object.
|
308
321
|
|
309
322
|
To set an attribute within a specific test, set the attribute in the `it` block and then **(re-)converge the node**:
|
@@ -321,7 +334,6 @@ describe 'example::default' do
|
|
321
334
|
end
|
322
335
|
```
|
323
336
|
|
324
|
-
|
325
337
|
Using Chef Zero
|
326
338
|
---------------
|
327
339
|
By default, ChefSpec runs in Chef Solo mode. As of ChefSpec v3.1.0, you can ask ChefSpec to create an in-memory Chef Server during testing using [ChefZero](https://github.com/jkeiser/chef-zero). This is especially helpful if you need to support searching or data bags.
|
@@ -374,13 +386,13 @@ You may also be interested in the `stub_node` macro, which will create a new `Ch
|
|
374
386
|
|
375
387
|
```ruby
|
376
388
|
www = stub_node(platform: 'ubuntu', version: '12.04') do |node|
|
377
|
-
node['
|
389
|
+
node.set['attribute'] = 'value'
|
378
390
|
end
|
379
391
|
|
380
392
|
# `www` is now a local Chef::Node object you can use in your test. To push this
|
381
393
|
# node to the server, call `create_node`:
|
382
394
|
|
383
|
-
ChefSpec::Server.create_node(
|
395
|
+
ChefSpec::Server.create_node(www)
|
384
396
|
```
|
385
397
|
|
386
398
|
Create a role:
|
@@ -459,7 +471,7 @@ Real data_bags are disabled. Unregistered data_bag: data_bag(:users)
|
|
459
471
|
|
460
472
|
You can stub this data_bag with:
|
461
473
|
|
462
|
-
stub_data_bag("users").and_return(
|
474
|
+
stub_data_bag("users").and_return([])
|
463
475
|
|
464
476
|
============================================================
|
465
477
|
```
|
@@ -481,10 +493,7 @@ describe 'example::default' do
|
|
481
493
|
let(:chef_run) { ChefSpec::Runner.new }
|
482
494
|
|
483
495
|
before do
|
484
|
-
stub_data_bag('users').and_return([
|
485
|
-
{ id: 'svargo' },
|
486
|
-
{ id: 'francis' }
|
487
|
-
])
|
496
|
+
stub_data_bag('users').and_return(['svargo', 'francis'])
|
488
497
|
|
489
498
|
stub_data_bag_item('users', 'svargo').and_return({ ... })
|
490
499
|
stub_data_bag_item('users', 'francis') { (ruby code) }
|
@@ -541,14 +550,15 @@ end
|
|
541
550
|
|
542
551
|
Reporting
|
543
552
|
---------
|
544
|
-
ChefSpec
|
553
|
+
ChefSpec can generate a report of resources read over resources tested. Please note, this feature is currently in beta phases and may not be 100% accurate. That being said, it is currently the only code coverage tool available for Chef recipes.
|
545
554
|
|
546
|
-
To generate the coverage report, add the following to
|
555
|
+
To generate the coverage report, add the following to your `spec_helper.rb` before you require any "Chef" code:
|
547
556
|
|
548
557
|
```ruby
|
549
|
-
|
558
|
+
require 'chefspec'
|
559
|
+
ChefSpec::Coverage.start!
|
550
560
|
|
551
|
-
|
561
|
+
# Existing spec_helper contents...
|
552
562
|
```
|
553
563
|
|
554
564
|
By default, that method will output helpful information to standard out:
|
@@ -562,21 +572,73 @@ ChefSpec Coverage report generated at '.coverage/results.json':
|
|
562
572
|
|
563
573
|
Untouched Resources:
|
564
574
|
|
565
|
-
package[git]
|
566
|
-
package[build-essential]
|
567
|
-
package[apache2]
|
568
|
-
package[libvrt]
|
569
|
-
package[core]
|
575
|
+
package[git] bacon/recipes/default.rb:2
|
576
|
+
package[build-essential] bacon/recipes/default.rb:3
|
577
|
+
package[apache2] bacon/recipes/default.rb:4
|
578
|
+
package[libvrt] bacon/recipes/default.rb:5
|
579
|
+
package[core] bacon/recipes/default.rb:6
|
570
580
|
```
|
571
581
|
|
572
582
|
It also outputs a machine-parsable JSON file at `.coverage/results.json`. This file can be read by your CI server to determine changes in code coverage. We recommend adding the `.coverage` directory to your `.gitignore` to avoid committing it to git.
|
573
583
|
|
574
584
|
You can configure both the announcing behavior and JSON file. Please see the YARD documentation for more information.
|
575
585
|
|
576
|
-
|
586
|
+
By default, ChefSpec will test all cookbooks that are loaded as part of the Chef Client run. If you have a cookbook with many dependencies, this may be less than desireable. To restrict coverage reporting against certain cookbooks, `ChefSpec::Coverage` yields a block:
|
577
587
|
|
578
588
|
```ruby
|
579
|
-
|
589
|
+
ChefSpec::Coverage.start! do
|
590
|
+
add_filter 'vendor/cookbooks'
|
591
|
+
end
|
592
|
+
```
|
593
|
+
|
594
|
+
The `add_filter` method accepts a variety of objects. For example:
|
595
|
+
|
596
|
+
```ruby
|
597
|
+
ChefSpec::Coverage.start! do
|
598
|
+
# Strings are interpreted as file paths, with a forward anchor
|
599
|
+
add_filter 'vendor/cookbooks'
|
600
|
+
|
601
|
+
# Regular expressions must be escaped, but provide a nicer API for negative
|
602
|
+
# back tracking
|
603
|
+
add_filter /cookbooks\/(?!omnibus)/
|
604
|
+
|
605
|
+
# Custom block filters yield a {Chef::Resource} object - if the block
|
606
|
+
# evaluates to true, it will be filtered
|
607
|
+
add_filter do |resource|
|
608
|
+
# Bob's cookbook's are completely untested! Ignore them until he gets his
|
609
|
+
# shit together.
|
610
|
+
resource.source_file =~ /cookbooks\/bob-(.+)/
|
611
|
+
end
|
612
|
+
end
|
613
|
+
```
|
614
|
+
|
615
|
+
For more complex scenarios, you can create a custom `Filter` object that inherits from `ChefSpec::Coverage::Filter` and implements the `matches?` method.
|
616
|
+
|
617
|
+
```ruby
|
618
|
+
class CustomFilter < ChefSpec::Coverage::Filter
|
619
|
+
def initialize(arg1, arg2, &block)
|
620
|
+
# Create a custom initialization method, do some magic, etc.
|
621
|
+
end
|
622
|
+
|
623
|
+
def matches?(resource)
|
624
|
+
# Custom matching logic in here - anything that evaluates to "true" will be
|
625
|
+
# filtered.
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
ChefSpec::Converage.start! do
|
630
|
+
add_filter CustomFilter.new('foo', :bar)
|
631
|
+
end
|
632
|
+
```
|
633
|
+
|
634
|
+
If you are using ChefSpec's Berkshelf plugin, a filter is automatically created for you. If you would like to ignore that filter, you can `clear` all the filters before defining your own:
|
635
|
+
|
636
|
+
```ruby
|
637
|
+
ChefSpec::Coverage.start! do
|
638
|
+
filters.clear
|
639
|
+
|
640
|
+
# Add your custom filters now
|
641
|
+
end
|
580
642
|
```
|
581
643
|
|
582
644
|
|
@@ -13,14 +13,14 @@ describe 'stub_data_bag::default' do
|
|
13
13
|
|
14
14
|
context 'as a String' do
|
15
15
|
it 'does not raise an exception' do
|
16
|
-
stub_data_bag('users').and_return([
|
16
|
+
stub_data_bag('users').and_return(['svargo'])
|
17
17
|
expect { chef_run }.to_not raise_error
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
context 'as a Symbol' do
|
22
22
|
it 'does not raise an exception' do
|
23
|
-
stub_data_bag(:users).and_return([
|
23
|
+
stub_data_bag(:users).and_return(['svargo'])
|
24
24
|
expect { chef_run }.to_not raise_error
|
25
25
|
end
|
26
26
|
end
|
data/lib/chefspec/berkshelf.rb
CHANGED
@@ -21,15 +21,20 @@ module ChefSpec
|
|
21
21
|
# Setup and install the necessary dependencies in the temporary directory.
|
22
22
|
#
|
23
23
|
def setup!
|
24
|
+
berksfile = ::Berkshelf::Berksfile.from_file('Berksfile')
|
25
|
+
|
24
26
|
::Berkshelf.ui.mute do
|
25
27
|
if ::Berkshelf::Berksfile.method_defined?(:vendor)
|
26
28
|
FileUtils.rm_rf(@tmpdir) # Berkshelf 3.0 requires the directory to not exist
|
27
|
-
|
29
|
+
berksfile.vendor(@tmpdir)
|
28
30
|
else
|
29
|
-
|
31
|
+
berksfile.install(path: @tmpdir)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
35
|
+
filter = Coverage::BerkshelfFilter.new(berksfile)
|
36
|
+
Coverage.add_filter(filter)
|
37
|
+
|
33
38
|
::RSpec.configure { |config| config.cookbook_path = @tmpdir }
|
34
39
|
end
|
35
40
|
|
data/lib/chefspec/coverage.rb
CHANGED
@@ -1,21 +1,71 @@
|
|
1
|
+
require_relative 'coverage/filters'
|
2
|
+
|
1
3
|
module ChefSpec
|
2
4
|
class Coverage
|
3
|
-
|
4
|
-
|
5
|
+
EXIT_FAILURE = 1
|
6
|
+
EXIT_SUCCESS = 0
|
5
7
|
|
6
8
|
class << self
|
7
|
-
|
8
|
-
|
9
|
+
def method_added(name)
|
10
|
+
# Only delegate public methods
|
11
|
+
if method_defined?(name)
|
12
|
+
instance_eval <<-EOH, __FILE__, __LINE__ + 1
|
13
|
+
def #{name}(*args, &block)
|
14
|
+
instance.public_send(:#{name}, *args, &block)
|
15
|
+
end
|
16
|
+
EOH
|
17
|
+
end
|
18
|
+
end
|
9
19
|
end
|
10
20
|
|
11
21
|
include Singleton
|
12
22
|
|
23
|
+
attr_reader :filters
|
24
|
+
|
13
25
|
#
|
14
26
|
# Create a new coverage object singleton.
|
15
27
|
#
|
16
28
|
def initialize
|
17
29
|
@collection = {}
|
18
|
-
@filters
|
30
|
+
@filters = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Start the coverage reporting analysis. This method also adds the the
|
35
|
+
# +at_exit+ handler for printing the coverage report.
|
36
|
+
#
|
37
|
+
def start!(*args, &block)
|
38
|
+
instance_eval(&block) if block
|
39
|
+
at_exit { ChefSpec::Coverage.report!(*args) }
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Add a filter to the converage analysis.
|
44
|
+
#
|
45
|
+
# @param [Filter, String, Regexp] filter
|
46
|
+
# the filter to add
|
47
|
+
# @param [Proc] block
|
48
|
+
# the block to use as a filter
|
49
|
+
#
|
50
|
+
# @return [true]
|
51
|
+
#
|
52
|
+
def add_filter(filter = nil, &block)
|
53
|
+
id = "#{filter.inspect}/#{block.inspect}".hash
|
54
|
+
|
55
|
+
@filters[id] = if filter.kind_of?(Filter)
|
56
|
+
filter
|
57
|
+
elsif filter.kind_of?(String)
|
58
|
+
StringFilter.new(filter)
|
59
|
+
elsif filter.kind_of?(Regexp)
|
60
|
+
RegexpFilter.new(filter)
|
61
|
+
elsif block
|
62
|
+
BlockFilter.new(block)
|
63
|
+
else
|
64
|
+
raise ArgumentError, 'Please specify either a string, ' \
|
65
|
+
'filter, or block to filter source files with!'
|
66
|
+
end
|
67
|
+
|
68
|
+
true
|
19
69
|
end
|
20
70
|
|
21
71
|
#
|
@@ -26,7 +76,7 @@ module ChefSpec
|
|
26
76
|
# @param [Chef::Resource] resource
|
27
77
|
#
|
28
78
|
def add(resource)
|
29
|
-
if !exists?(resource) && filtered?(resource)
|
79
|
+
if !exists?(resource) && !filtered?(resource)
|
30
80
|
@collection[resource.to_s] = ResourceWrapper.new(resource)
|
31
81
|
end
|
32
82
|
end
|
@@ -37,7 +87,7 @@ module ChefSpec
|
|
37
87
|
# @param [Chef::Resource] resource
|
38
88
|
#
|
39
89
|
def cover!(resource)
|
40
|
-
if
|
90
|
+
if wrapper = find(resource)
|
41
91
|
wrapper.touch!
|
42
92
|
end
|
43
93
|
end
|
@@ -49,7 +99,7 @@ module ChefSpec
|
|
49
99
|
# @param [Chef::Resource] resource
|
50
100
|
#
|
51
101
|
def filtered?(resource)
|
52
|
-
filters.
|
102
|
+
filters.any? { |_, filter| filter.matches?(resource) }
|
53
103
|
end
|
54
104
|
|
55
105
|
#
|
@@ -58,11 +108,11 @@ module ChefSpec
|
|
58
108
|
#
|
59
109
|
# @example Generating a report
|
60
110
|
#
|
61
|
-
#
|
111
|
+
# ChefSpec::Coverage.report!
|
62
112
|
#
|
63
113
|
# @example Generating a custom report without announcing
|
64
114
|
#
|
65
|
-
#
|
115
|
+
# ChefSpec::Coverage.report!('/custom/path', false)
|
66
116
|
#
|
67
117
|
#
|
68
118
|
# @param [String] output
|
@@ -71,6 +121,16 @@ module ChefSpec
|
|
71
121
|
# print the results to standard out
|
72
122
|
#
|
73
123
|
def report!(output = '.coverage/results.json', announce = true)
|
124
|
+
# Borrowed from simplecov#41
|
125
|
+
#
|
126
|
+
# If an exception is thrown that isn't a "SystemExit", we need to capture
|
127
|
+
# that error and re-raise.
|
128
|
+
if $!
|
129
|
+
exit_status = $!.is_a?(SystemExit) ? $!.status : EXIT_FAILURE
|
130
|
+
else
|
131
|
+
exit_status = EXIT_SUCCESS
|
132
|
+
end
|
133
|
+
|
74
134
|
report = {}
|
75
135
|
|
76
136
|
report[:total] = @collection.size
|
@@ -112,7 +172,7 @@ module ChefSpec
|
|
112
172
|
.select { |_, resource| !resource[:touched] }
|
113
173
|
.sort_by { |_, resource| [resource[:source][:file], resource[:source][:line]] }
|
114
174
|
.map do |name, resource|
|
115
|
-
" #{name} #{resource[:source][:file]}:#{resource[:source][:line]}"
|
175
|
+
" #{name.ljust(32)} #{resource[:source][:file]}:#{resource[:source][:line]}"
|
116
176
|
end
|
117
177
|
.flatten
|
118
178
|
.join("\n")
|
@@ -120,6 +180,9 @@ module ChefSpec
|
|
120
180
|
|
121
181
|
EOH
|
122
182
|
end
|
183
|
+
|
184
|
+
# Ensure we exit correctly (#351)
|
185
|
+
exit(exit_status)
|
123
186
|
end
|
124
187
|
|
125
188
|
private
|
@@ -148,7 +211,7 @@ module ChefSpec
|
|
148
211
|
file, line, *_ = @resource.source_line.split(':')
|
149
212
|
|
150
213
|
{
|
151
|
-
file: file,
|
214
|
+
file: shortname(file),
|
152
215
|
line: line.to_i,
|
153
216
|
}
|
154
217
|
end
|
@@ -167,6 +230,18 @@ module ChefSpec
|
|
167
230
|
def touched?
|
168
231
|
!!@touched
|
169
232
|
end
|
233
|
+
|
234
|
+
private
|
235
|
+
|
236
|
+
def shortname(file)
|
237
|
+
if file.include?(Dir.pwd)
|
238
|
+
file.split(Dir.pwd, 2).last
|
239
|
+
elsif file.include?('cookbooks')
|
240
|
+
file.split('cookbooks/', 2).last
|
241
|
+
else
|
242
|
+
file
|
243
|
+
end
|
244
|
+
end
|
170
245
|
end
|
171
246
|
end
|
172
247
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module ChefSpec
|
2
|
+
class Coverage
|
3
|
+
class Filter
|
4
|
+
def initialize(filter)
|
5
|
+
@filter = filter
|
6
|
+
end
|
7
|
+
|
8
|
+
def matches?
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# @example Match resources based on a regular expression.
|
15
|
+
# add_filter /^test/
|
16
|
+
#
|
17
|
+
class RegexpFilter < Filter
|
18
|
+
def matches?(resource)
|
19
|
+
@filter =~ resource.source_line
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# @example Match resources based on a regular expression.
|
25
|
+
# add_filter 'test/bar/zip'
|
26
|
+
#
|
27
|
+
class StringFilter < RegexpFilter
|
28
|
+
def initialize(filter)
|
29
|
+
super(Regexp.new("^#{filter}"))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# @example Match resources based on a custom block.
|
35
|
+
# # Ignore internal cookbooks
|
36
|
+
# add_filter do |resource|
|
37
|
+
# resource.name =~ /^acme-(.+)/
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
class BlockFilter < Filter
|
41
|
+
def matches?(resource)
|
42
|
+
@filter.call(resource)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# @example Ignore dependent cookbooks (via Berkshelf)
|
48
|
+
# add_filter BerkshelfFilter.new(berksfile)
|
49
|
+
#
|
50
|
+
class BerkshelfFilter < Filter
|
51
|
+
def initialize(berksfile)
|
52
|
+
@berksfile = berksfile
|
53
|
+
@metadatas = berksfile.dependencies.select(&:metadata?).map(&:name)
|
54
|
+
end
|
55
|
+
|
56
|
+
def matches?(resource)
|
57
|
+
resource.source_line =~ /cookbooks\/(?!#{@metadatas.join('|')})/
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,9 +1,15 @@
|
|
1
|
+
require 'rspec/matchers/built_in/raise_error'
|
2
|
+
|
1
3
|
class RSpec::Matchers::BuiltIn::RaiseError
|
2
4
|
class << self
|
3
5
|
attr_accessor :last_run
|
4
6
|
end
|
5
7
|
|
6
|
-
attr_reader :
|
8
|
+
attr_reader :expected_message
|
9
|
+
|
10
|
+
def last_error_for_chefspec
|
11
|
+
@expected_error
|
12
|
+
end
|
7
13
|
|
8
14
|
alias_method :old_matches?, :matches?
|
9
15
|
def matches?(*args)
|
@@ -28,8 +34,8 @@ module ChefSpec
|
|
28
34
|
private
|
29
35
|
|
30
36
|
def exception_matched?
|
31
|
-
@formatter_exception == @matcher.
|
32
|
-
@matcher.
|
37
|
+
@formatter_exception == @matcher.last_error_for_chefspec ||
|
38
|
+
@matcher.last_error_for_chefspec === @formatter_exception
|
33
39
|
end
|
34
40
|
|
35
41
|
def message_matched?
|
data/lib/chefspec/macros.rb
CHANGED
@@ -169,7 +169,10 @@ module ChefSpec
|
|
169
169
|
#
|
170
170
|
# @return [Chef::Node]
|
171
171
|
#
|
172
|
-
def stub_node(
|
172
|
+
def stub_node(*args, &block)
|
173
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
174
|
+
name = args.first || 'node.example'
|
175
|
+
|
173
176
|
fauxhai = Fauxhai.mock(options).data
|
174
177
|
fauxhai = fauxhai.merge(options[:ohai] || {})
|
175
178
|
fauxhai = Mash.new(fauxhai)
|
data/lib/chefspec/version.rb
CHANGED
@@ -14,7 +14,7 @@ describe ChefSpec::ExpectException do
|
|
14
14
|
subject { described_class.new(RuntimeError) }
|
15
15
|
|
16
16
|
it 'does not match' do
|
17
|
-
last_error = double('last error',
|
17
|
+
last_error = double('last error', last_error_for_chefspec: ArgumentError)
|
18
18
|
RSpec::Matchers::BuiltIn::RaiseError.stub(:last_run).and_return(last_error)
|
19
19
|
expect(subject.expected?).to be_false
|
20
20
|
end
|
@@ -24,7 +24,7 @@ describe ChefSpec::ExpectException do
|
|
24
24
|
subject { described_class.new(RuntimeError) }
|
25
25
|
|
26
26
|
it 'does not match' do
|
27
|
-
last_error = double('last error',
|
27
|
+
last_error = double('last error', last_error_for_chefspec: RuntimeError)
|
28
28
|
RSpec::Matchers::BuiltIn::RaiseError.stub(:last_run).and_return(last_error)
|
29
29
|
expect(subject.expected?).to be_true
|
30
30
|
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
@@ -9,138 +9,138 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '11.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '11.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: fauxhai
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '2.14'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '2.14'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: i18n
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.6.9
|
63
|
-
- - <
|
63
|
+
- - "<"
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: 1.0.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 0.6.9
|
73
|
-
- - <
|
73
|
+
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.0.0
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: chef-zero
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.7'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.7'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: rake
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: redcarpet
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.0'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: yard
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.8'
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0.8'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: aruba
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.5'
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0.5'
|
146
146
|
description: ChefSpec is a unit testing and resource coverage (code coverage) framework
|
@@ -153,8 +153,8 @@ executables: []
|
|
153
153
|
extensions: []
|
154
154
|
extra_rdoc_files: []
|
155
155
|
files:
|
156
|
-
- .gitignore
|
157
|
-
- .travis.yml
|
156
|
+
- ".gitignore"
|
157
|
+
- ".travis.yml"
|
158
158
|
- CHANGELOG.md
|
159
159
|
- CONTRIBUTING.md
|
160
160
|
- Gemfile
|
@@ -693,6 +693,7 @@ files:
|
|
693
693
|
- lib/chefspec/berkshelf.rb
|
694
694
|
- lib/chefspec/cacher.rb
|
695
695
|
- lib/chefspec/coverage.rb
|
696
|
+
- lib/chefspec/coverage/filters.rb
|
696
697
|
- lib/chefspec/deprecations.rb
|
697
698
|
- lib/chefspec/errors.rb
|
698
699
|
- lib/chefspec/expect_exception.rb
|
@@ -767,17 +768,17 @@ require_paths:
|
|
767
768
|
- lib
|
768
769
|
required_ruby_version: !ruby/object:Gem::Requirement
|
769
770
|
requirements:
|
770
|
-
- -
|
771
|
+
- - ">="
|
771
772
|
- !ruby/object:Gem::Version
|
772
773
|
version: '1.9'
|
773
774
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
774
775
|
requirements:
|
775
|
-
- -
|
776
|
+
- - ">="
|
776
777
|
- !ruby/object:Gem::Version
|
777
778
|
version: '0'
|
778
779
|
requirements: []
|
779
780
|
rubyforge_project:
|
780
|
-
rubygems_version: 2.2.
|
781
|
+
rubygems_version: 2.2.2
|
781
782
|
signing_key:
|
782
783
|
specification_version: 4
|
783
784
|
summary: Write RSpec examples and generate coverage reports for Chef recipes!
|