chefspec 7.1.0 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3617560994bd67eae8bece75bdfcd66c6fcc259
4
- data.tar.gz: 953c6f0e6e1471483ad9d7fd1f9ecb8b7d77f5be
3
+ metadata.gz: f005ab1291a2ded9f315a6418b743ef40d1922ef
4
+ data.tar.gz: 64956c585525980326afb3d4989e89fbbcdaad85
5
5
  SHA512:
6
- metadata.gz: 2f6016eb17cf6fcbb0497d1b9f097f5f4ddc54002572653ff87c666a60bb7819d38e4c452ff14bb3c49cb3c3705fbe79f373f00662e98a5524019b507bc509ee
7
- data.tar.gz: ab41f6c8868ba16d5f6f350a847e5314d1c983bccb98aab78a9de6bd99ea0a835b95be565263b69c81777063ad98af3d4605a8f2e6fc4fce8363d15ec17d5151
6
+ metadata.gz: f4d999d60cdbc5c28d6a197b0ff005cfe9fe90ba5118ec4688d739c6464f409eabced2e394872d310224218640daa1316f9df494f3608fbeff428460a6d991ac
7
+ data.tar.gz: 3d56a13c1b8523067e4a401ae1601b5b97461fc282d993c4a8eeef1a2e15cd9571c1752173d11a74c5e17215689b354e1115a51dd7bf1535348b7f96c49dabaf
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG for ChefSpec
2
2
 
3
+ ## 7.1.1 (November 28, 2017)
4
+
5
+ - Better support for matching action :nothing in resources
6
+
3
7
  ## 7.1.0 (May 9, 2017)
4
8
 
5
9
  - Resource matchers are now generated automatically. What does this mean for you? A lot:
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
- ## Setting node Attributes
378
+ ## Specifying Node Information
379
379
 
380
- Node attribute can be set when creating the `Runner`. The initializer yields a block that gives full access to the node object:
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,13 @@
1
+ ruby_block 'yes' do
2
+ block { }
3
+ end
4
+
5
+ ruby_block 'no' do
6
+ action :nothing
7
+ block { }
8
+ end
9
+
10
+ ruby_block 'both' do
11
+ action [:run, :nothing]
12
+ block { }
13
+ end
@@ -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
@@ -52,7 +52,11 @@ module ChefSpec::Extensions::Chef::Resource
52
52
  end
53
53
 
54
54
  def performed_action?(action)
55
- !!performed_action(action)
55
+ if action == :nothing
56
+ performed_actions.empty?
57
+ else
58
+ !!performed_action(action)
59
+ end
56
60
  end
57
61
 
58
62
  def performed_actions
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '7.1.0'
2
+ VERSION = '7.1.1'
3
3
  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: 7.1.0
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-05-12 00:00:00.000000000 Z
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.11
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!