chefspec 7.1.0 → 7.1.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/CHANGELOG.md +4 -0
- data/README.md +21 -2
- data/examples/nothing_matcher/recipes/default.rb +13 -0
- data/examples/nothing_matcher/spec/default_spec.rb +20 -0
- data/lib/chefspec/extensions/chef/resource.rb +5 -1
- data/lib/chefspec/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f005ab1291a2ded9f315a6418b743ef40d1922ef
|
4
|
+
data.tar.gz: 64956c585525980326afb3d4989e89fbbcdaad85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d999d60cdbc5c28d6a197b0ff005cfe9fe90ba5118ec4688d739c6464f409eabced2e394872d310224218640daa1316f9df494f3608fbeff428460a6d991ac
|
7
|
+
data.tar.gz: 3d56a13c1b8523067e4a401ae1601b5b97461fc282d993c4a8eeef1a2e15cd9571c1752173d11a74c5e17215689b354e1115a51dd7bf1535348b7f96c49dabaf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -375,9 +375,28 @@ expect(resource).to do_nothing
|
|
375
375
|
|
376
376
|
**For more complex examples, please see the [examples directory](https://github.com/sethvargo/chefspec/tree/master/examples) or the [Yard documentation](http://rubydoc.info/github/sethvargo/chefspec).**
|
377
377
|
|
378
|
-
##
|
378
|
+
## Specifying Node Information
|
379
379
|
|
380
|
-
Node
|
380
|
+
Node information can be set when creating the `Runner`. The initializer yields a block that gives full access to the node object:
|
381
|
+
|
382
|
+
```ruby
|
383
|
+
describe 'example::default' do
|
384
|
+
let(:chef_run) do
|
385
|
+
ChefSpec::SoloRunner.new do |node|
|
386
|
+
node.name 'test.node-1'
|
387
|
+
end.converge(described_recipe)
|
388
|
+
end
|
389
|
+
|
390
|
+
it 'has node name set' do
|
391
|
+
expect(chef_run.node.name).to eq('test.node-1')
|
392
|
+
end
|
393
|
+
end
|
394
|
+
```
|
395
|
+
|
396
|
+
|
397
|
+
### Setting Node Attributes
|
398
|
+
|
399
|
+
Node attributes can also be set inside the initializer block:
|
381
400
|
|
382
401
|
```ruby
|
383
402
|
describe 'example::default' do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'nothing_matcher::default' do
|
4
|
+
subject(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
|
+
|
6
|
+
context 'a resource with action :run' do
|
7
|
+
it { is_expected.to run_ruby_block('yes') }
|
8
|
+
it { is_expected.to_not nothing_ruby_block('yes') }
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'a resource with action :nothing' do
|
12
|
+
it { is_expected.to_not run_ruby_block('no') }
|
13
|
+
it { is_expected.to nothing_ruby_block('no') }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'a resource with action [:run, :nothing]' do
|
17
|
+
it { is_expected.to run_ruby_block('both') }
|
18
|
+
it { is_expected.to_not nothing_ruby_block('both') }
|
19
|
+
end
|
20
|
+
end
|
data/lib/chefspec/version.rb
CHANGED
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: 7.1.
|
4
|
+
version: 7.1.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: 2017-
|
12
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -336,6 +336,8 @@ files:
|
|
336
336
|
- examples/multiple_actions/spec/sequential_spec.rb
|
337
337
|
- examples/multiple_run_action/recipes/default.rb
|
338
338
|
- examples/multiple_run_action/spec/default_spec.rb
|
339
|
+
- examples/nothing_matcher/recipes/default.rb
|
340
|
+
- examples/nothing_matcher/spec/default_spec.rb
|
339
341
|
- examples/notifications/recipes/before.rb
|
340
342
|
- examples/notifications/recipes/chained.rb
|
341
343
|
- examples/notifications/recipes/default.rb
|
@@ -758,7 +760,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
758
760
|
version: '0'
|
759
761
|
requirements: []
|
760
762
|
rubyforge_project:
|
761
|
-
rubygems_version: 2.6.
|
763
|
+
rubygems_version: 2.6.13
|
762
764
|
signing_key:
|
763
765
|
specification_version: 4
|
764
766
|
summary: Write RSpec examples and generate coverage reports for Chef recipes!
|