chefspec 4.0.0 → 4.0.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: fd833d7dcb6a3d973ccd35a43a0f606142244b8f
4
- data.tar.gz: c2c2d2832263d9868c542d7cc005b4f626bfe863
3
+ metadata.gz: 4b356cb25522616e55756a68cffb0fee6bbac9bb
4
+ data.tar.gz: 587c6da791e7fdac91ba470e47ba9ec182858874
5
5
  SHA512:
6
- metadata.gz: 02158758eeff60f14350d2084279b07046c1534e04f20f7392700471b79bd44316ddd57af76a21420e613ca7c115c33870fbcec3de4ea027e20a8575bef1e529
7
- data.tar.gz: 62660485d2405c57a6e17a1b566f7a344ef86fad27fba8520a5aea451a304bd5429d5a72aab869c37c4c7cebd869b8e8f16a6311cdce9466826ee7b04ff03691
6
+ metadata.gz: bc83045236dca71e9627037bda4fb8288326daaaccae04d08ba09dfc30b02af46d2026b86cd7160752ad5c1f3968daa28455d6bdc5f0b732f526690e1e78b43b
7
+ data.tar.gz: 511164cffb5fa1e6b7f0f6ca1f3b2a24badd219448f4034e3b9b8c8f22d0b68d8c195a6d60084038ea92e4341e01c05d5e0bd31469a8ca28ca1fe3938006a114
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  CHANGELOG for ChefSpec
2
2
  ======================
3
3
 
4
+ ## 4.0.1 (June 27, 2014)
5
+ Bugfixes:
6
+ - Fix class comparisons
7
+ - Update ChefZero API to work again
8
+ - Use proper cookbook in the template_finder
9
+ - Fix Ruby deprecations
10
+ - Various documentation updates
11
+
4
12
  ## 4.0.0 (June 2, 2014)
5
13
  Breaking Changes:
6
14
  - **Upgraded to RSpec 3!** RSpec 3 brings many new API changes and syntaxes
data/README.md CHANGED
@@ -90,9 +90,6 @@ RSpec.configure do |config|
90
90
  # the location of the calling spec file])
91
91
  config.cookbook_path = '/var/cookbooks'
92
92
 
93
- # Set the organization for Chef Zero (default: 'chefspec')
94
- config.organization = 'sweetsauce'
95
-
96
93
  # Specify the path for Chef Solo to find roles (default: [ascending search])
97
94
  config.role_path = '/var/roles'
98
95
 
@@ -488,7 +485,7 @@ data_bag('users').each do |user|
488
485
  end
489
486
  ```
490
487
 
491
- ChefSpec will rails an error like:
488
+ ChefSpec will raise an error like:
492
489
 
493
490
  ```text
494
491
  Real data_bags are disabled. Unregistered data_bag: data_bag(:users)
@@ -6,10 +6,10 @@ Feature: The ChefSpec server
6
6
  * I am using the "server" cookbook
7
7
 
8
8
  Scenario Outline: Running specs
9
- * I successfully run `rspec spec/<Compontent>_spec.rb`
9
+ * I successfully run `rspec spec/<Component>_spec.rb`
10
10
  * the output should contain "0 failures"
11
11
  Examples:
12
- | Compontent |
12
+ | Component |
13
13
  | client |
14
14
  | data_bag |
15
15
  | environment |
@@ -46,7 +46,7 @@ module ChefSpec
46
46
  # Destroy the installed Berkshelf at the temporary directory.
47
47
  #
48
48
  def teardown!
49
- FileUtils.rm_rf(@tmpdir) if File.exists?(@tmpdir)
49
+ FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
50
50
  end
51
51
  end
52
52
  end
@@ -38,8 +38,8 @@ module ChefSpec
38
38
  def teardown!
39
39
  env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
40
40
  env.config_db.local['path'] = @originalpath
41
-
42
- FileUtils.rm_rf(@tmpdir) if File.exists?(@tmpdir)
41
+
42
+ FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
43
43
  end
44
44
  end
45
45
  end
@@ -111,11 +111,15 @@ module ChefSpec::Matchers
111
111
  end
112
112
 
113
113
  def matches_parameter?(parameter, expected)
114
- # Chef 11+ stores the source parameter internally as an Array
114
+ value = safe_send(parameter)
115
115
  if parameter == :source
116
- Array(expected) == Array(safe_send(parameter))
116
+ # Chef 11+ stores the source parameter internally as an Array
117
+ Array(expected) == Array(value)
118
+ elsif expected.kind_of?(Class)
119
+ # Ruby can't compare classes with ===
120
+ expected == value
117
121
  else
118
- expected === safe_send(parameter)
122
+ expected === value
119
123
  end
120
124
  end
121
125
 
@@ -68,7 +68,7 @@ module ChefSpec
68
68
  template_context = Chef::Mixin::Template::TemplateContext.new([])
69
69
  template_context.update({
70
70
  :node => chef_run.node,
71
- :template_finder => template_finder(chef_run, cookbook_name),
71
+ :template_finder => template_finder(chef_run, template.cookbook_name),
72
72
  }.merge(template.variables))
73
73
  if template.respond_to?(:helper_modules) # Chef 11.4+
74
74
  template.helper_modules.each do |helper_module|
@@ -10,7 +10,6 @@ RSpec.configure do |config|
10
10
  end
11
11
 
12
12
  config.add_setting :cookbook_path
13
- config.add_setting :organization, default: 'chefspec'
14
13
  config.add_setting :role_path
15
14
  config.add_setting :log_level, default: :warn
16
15
  config.add_setting :path
@@ -285,7 +285,7 @@ module ChefSpec
285
285
  def default_role_path
286
286
  Pathname.new(Dir.pwd).ascend do |path|
287
287
  possible = File.join(path, 'roles')
288
- return possible if File.exists?(possible)
288
+ return possible if File.exist?(possible)
289
289
  end
290
290
 
291
291
  nil
@@ -152,8 +152,7 @@ module ChefSpec
152
152
 
153
153
  #
154
154
  # Create a new instance of the +ChefSpec::Server+ singleton. This method
155
- # also starts the Chef Zero server in the background under the organization
156
- # "chefspec".
155
+ # also starts the Chef Zero server in the background.
157
156
  #
158
157
  def initialize
159
158
  @server = ChefZero::Server.new(
@@ -233,12 +232,12 @@ module ChefSpec
233
232
  end
234
233
 
235
234
  #
236
- # The URL where ChefZero is listening (including the organization).
235
+ # The URL where ChefZero is listening.
237
236
  #
238
237
  # @return [String]
239
238
  #
240
239
  def chef_server_url
241
- @chef_server_url ||= File.join(@server.url, 'organizations', organization)
240
+ @chef_server_url ||= File.join(@server.url)
242
241
  end
243
242
 
244
243
  #
@@ -257,7 +256,6 @@ module ChefSpec
257
256
  #
258
257
  def reset!
259
258
  @server.clear_data
260
- @server.data_store.create_dir(['organizations'], organization)
261
259
  end
262
260
 
263
261
  #
@@ -271,15 +269,6 @@ module ChefSpec
271
269
 
272
270
  private
273
271
 
274
- #
275
- # The name of the Chef organization.
276
- #
277
- # @return [String]
278
- #
279
- def organization
280
- RSpec.configuration.organization
281
- end
282
-
283
272
  #
284
273
  # The directory where any cache information (such as private keys) should
285
274
  # be stored. This cache is destroyed at the end of the run.
@@ -303,7 +292,7 @@ module ChefSpec
303
292
  # to the server
304
293
  #
305
294
  def load_data(name, key, data = {})
306
- @server.load_data({ key => { name => data } }, organization)
295
+ @server.load_data({ key => { name => data } })
307
296
  end
308
297
 
309
298
  #
@@ -311,22 +300,12 @@ module ChefSpec
311
300
  #
312
301
  def get(*args)
313
302
  if args.size == 1
314
- @server.data_store.list(with_organization(*args))
303
+ @server.data_store.list(args)
315
304
  else
316
- @server.data_store.get(with_organization(*args))
305
+ @server.data_store.get(args)
317
306
  end
318
307
  end
319
308
 
320
- #
321
- # Prefix the given args with the organization. This is used by the data
322
- # store to fetch elements.
323
- #
324
- # @return [Array<String>]
325
- #
326
- def with_organization(*args)
327
- ['organizations', organization, *args]
328
- end
329
-
330
309
  #
331
310
  # A randomly assigned, open port for run the Chef Zero server.
332
311
  #
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.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: 4.0.0
4
+ version: 4.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: 2014-06-02 00:00:00.000000000 Z
12
+ date: 2014-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef