chefspec 3.1.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bf78a43443b7bf6d169b3de994c43635190082f
4
- data.tar.gz: d6dd0630dc5f670e7037594fce9f2073bf5bc0e8
3
+ metadata.gz: ed014e65ab7679c297ff2c9ba74f55ba32c0f073
4
+ data.tar.gz: 26e8d01c3cf74991bfaaa9bc78f473a143ee5fee
5
5
  SHA512:
6
- metadata.gz: d12dc6f4f2fcc138e9b36be1e5a4b8f87011906edf358b749acf28a7b8d84524efae0f33e07bb3e0c1e393265c1d5271f3067bbe1350bf8ff1d5b020f824e9dc
7
- data.tar.gz: a9a7bf4ae1e7d085697eaec8c872113c65310bc82b13eae615fa789a8f070ab78a3d2a10566914cd0f9d8d38505671a037de447ec1cf96f8ab0cbd67afb5d87a
6
+ metadata.gz: 487d73acc66883931474cc2ed0614b84b892b6e22cb1ad340d118aae007744c519962d6661a4086aa6761eec88f282e31adb2bb8a5ef7d82b2bf329b8ad2ae92
7
+ data.tar.gz: 951cd1b4af13bf3732c624f403771abeb909f0f89b7974db975149c23e5d861f2ddb6a0740b83ea2b4b40a084250a64dc2531c810eab6087590ead8349a3c0f4
@@ -19,12 +19,16 @@ module ChefSpec
19
19
  end
20
20
 
21
21
  #
22
- # Add a resource to the resource collection.
22
+ # Add a resource to the resource collection. Only new resources are added
23
+ # and only resources that match the given filter are covered (which is *
24
+ # by default).
23
25
  #
24
26
  # @param [Chef::Resource] resource
25
27
  #
26
28
  def add(resource)
27
- @collection[resource.to_s] = ResourceWrapper.new(resource) if filtered?(resource)
29
+ if !exists?(resource) && filtered?(resource)
30
+ @collection[resource.to_s] = ResourceWrapper.new(resource)
31
+ end
28
32
  end
29
33
 
30
34
  #
@@ -39,7 +43,8 @@ module ChefSpec
39
43
  end
40
44
 
41
45
  #
42
- # Called to check if a resource belongs to a cookbook from the specified directories
46
+ # Called to check if a resource belongs to a cookbook from the specified
47
+ # directories.
43
48
  #
44
49
  # @param [Chef::Resource] resource
45
50
  #
@@ -117,6 +122,10 @@ module ChefSpec
117
122
  @collection[resource.to_s]
118
123
  end
119
124
 
125
+ def exists?(resource)
126
+ !find(resource).nil?
127
+ end
128
+
120
129
  class ResourceWrapper
121
130
  attr_reader :resource
122
131
 
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '3.1.0'
2
+ VERSION = '3.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: 3.1.0
4
+ version: 3.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: 2013-12-29 00:00:00.000000000 Z
12
+ date: 2013-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -255,6 +255,6 @@ rubyforge_project:
255
255
  rubygems_version: 2.2.0
256
256
  signing_key:
257
257
  specification_version: 4
258
- summary: chefspec-3.1.0
258
+ summary: chefspec-3.1.1
259
259
  test_files: []
260
260
  has_rdoc: