chefspec 4.0.1 → 4.0.2

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: 4b356cb25522616e55756a68cffb0fee6bbac9bb
4
- data.tar.gz: 587c6da791e7fdac91ba470e47ba9ec182858874
3
+ metadata.gz: 42b8dc074521cc846b3577e67be0b31cefbd11bd
4
+ data.tar.gz: b49ec85da25e784e7688674100a675842d92448d
5
5
  SHA512:
6
- metadata.gz: bc83045236dca71e9627037bda4fb8288326daaaccae04d08ba09dfc30b02af46d2026b86cd7160752ad5c1f3968daa28455d6bdc5f0b732f526690e1e78b43b
7
- data.tar.gz: 511164cffb5fa1e6b7f0f6ca1f3b2a24badd219448f4034e3b9b8c8f22d0b68d8c195a6d60084038ea92e4341e01c05d5e0bd31469a8ca28ca1fe3938006a114
6
+ metadata.gz: 5f5fbfb4a6746c897e50bccc8207bfcbbbaee688849eb6ffa28db24b88b9fa594b9b8fe9c5a745305f96440d21bf2a2ea2d137da1b7bd9a0ae154e5591706fc5
7
+ data.tar.gz: 6ab6c2840dcec33358b7d507fd16147e99eaa3d0f9e8c0efbfa52e854c3977b056f91d31488223871032ee5ad057da236100cf858fd4c00c449bc78b68b2466c
data/.travis.yml CHANGED
@@ -20,6 +20,7 @@ bundler_args: --jobs 7
20
20
 
21
21
  gemfile:
22
22
  - gemfiles/chef-11.12.0.gemfile
23
+ - gemfiles/chef-11.14.0.gemfile
23
24
  - gemfiles/chef-master.gemfile
24
25
 
25
26
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  CHANGELOG for ChefSpec
2
2
  ======================
3
3
 
4
+ ## 4.0.2 (August 13, 2014)
5
+ Bugfixes:
6
+ - Fix a regression caused by a new version of Chef Zero in single_org mode
7
+
8
+ Improvements:
9
+ - Test against Chef 11.14.0 in the Travis matrix
10
+
4
11
  ## 4.0.1 (June 27, 2014)
5
12
  Bugfixes:
6
13
  - Fix class comparisons
@@ -1,7 +1,7 @@
1
1
  require_relative '../libraries/resource_service'
2
2
 
3
3
  describe 'heavy_provider_light_resource::default' do
4
- it "does not bomb (because the resource was not wiped out when the provider was encountered" do
4
+ it "does not bomb (because the resource was not wiped out when the provider was encountered)" do
5
5
  ChefSpec::Runner.new.converge(described_recipe)
6
6
  end
7
7
  end
@@ -15,26 +15,29 @@ describe 'server::node' do
15
15
  .with_message('node[bacon], node[chefspec]')
16
16
  end
17
17
 
18
- it 'loads ohai data' do
19
- chef_run = ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04')
20
- .converge(described_recipe)
21
-
22
- expect(ChefSpec::Server).to have_node('chefspec')
23
-
24
- node = ChefSpec::Server.node('chefspec')
25
- expect(node['kernel']['name']).to eq('Linux')
26
- expect(node['kernel']['release']).to eq('3.2.0-26-generic')
27
- expect(node['kernel']['machine']).to eq('x86_64')
18
+ context 'with custom Ohai data' do
19
+ it 'has the node data' do
20
+ ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04')
21
+ .converge(described_recipe)
22
+
23
+ expect(ChefSpec::Server).to have_node('chefspec')
24
+
25
+ node = ChefSpec::Server.node('chefspec')
26
+ expect(node['kernel']['name']).to eq('Linux')
27
+ expect(node['kernel']['release']).to eq('3.2.0-26-generic')
28
+ expect(node['kernel']['machine']).to eq('x86_64')
29
+ end
28
30
  end
29
31
 
30
- it 'uses overridden ohai data' do
31
- chef_run = ChefSpec::Runner.new do |node|
32
- node.set['breakfast']['bacon'] = true
33
- end.converge(described_recipe)
32
+ context 'with overridden node data' do
33
+ it 'has the node data' do
34
+ ChefSpec::Runner.new { |node| node.set['breakfast']['bacon'] = true }
35
+ .converge(described_recipe)
34
36
 
35
- expect(ChefSpec::Server).to have_node('chefspec')
37
+ expect(ChefSpec::Server).to have_node('chefspec')
36
38
 
37
- node = ChefSpec::Server.node('chefspec')
38
- expect(node['breakfast']['bacon']).to be_truthy
39
+ node = ChefSpec::Server.node('chefspec')
40
+ expect(node['breakfast']['bacon']).to be_truthy
41
+ end
39
42
  end
40
43
  end
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'chef', '~> 11.14.0'
4
+
5
+ gemspec :path => '..'
@@ -161,9 +161,6 @@ module ChefSpec
161
161
 
162
162
  # Set a random port so ChefSpec may be run in multiple jobs
163
163
  port: port,
164
-
165
- # Disable the "old" way - this is actually +multi_tenant: true+
166
- single_org: false,
167
164
  )
168
165
  end
169
166
 
@@ -299,6 +296,26 @@ module ChefSpec
299
296
  # Get the path to an item in the data store.
300
297
  #
301
298
  def get(*args)
299
+ # This is a real-life "what in the actual fuck!?". Since some engineers
300
+ # cannot seem to understand the importance of an unchanging public API,
301
+ # we have to implement crazy, outlandish checks like this.
302
+ #
303
+ # In the 2.0 series of Chef Zero, the DataStore did not prefix values.
304
+ # In the 2.1+ series, DataStore values are nested under
305
+ # +organizations/chef+, for some ridiciously reason.
306
+ #
307
+ # Oh, and for the record, there was no CHANGELOG entry or anything. They
308
+ # just decided it would be a good idea to change one of the main APIs in
309
+ # the system.
310
+ if ChefZero::VERSION.to_f == 2.0
311
+ get_without_prefix(*args)
312
+ else
313
+ get_with_prefix(*args)
314
+ end
315
+ end
316
+
317
+ # @see {get}
318
+ def get_without_prefix(*args)
302
319
  if args.size == 1
303
320
  @server.data_store.list(args)
304
321
  else
@@ -306,6 +323,17 @@ module ChefSpec
306
323
  end
307
324
  end
308
325
 
326
+ # @see {get}
327
+ def get_with_prefix(*args)
328
+ args.unshift('organizations', 'chef')
329
+
330
+ if args.size == 3
331
+ @server.data_store.list(args)
332
+ else
333
+ @server.data_store.get(args)
334
+ end
335
+ end
336
+
309
337
  #
310
338
  # A randomly assigned, open port for run the Chef Zero server.
311
339
  #
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '4.0.1'
2
+ VERSION = '4.0.2'
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.1
4
+ version: 4.0.2
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-27 00:00:00.000000000 Z
12
+ date: 2014-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -605,6 +605,7 @@ files:
605
605
  - features/user.feature
606
606
  - features/yum_package.feature
607
607
  - gemfiles/chef-11.12.0.gemfile
608
+ - gemfiles/chef-11.14.0.gemfile
608
609
  - gemfiles/chef-master.gemfile
609
610
  - lib/chefspec.rb
610
611
  - lib/chefspec/api.rb
@@ -753,7 +754,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
753
754
  version: '0'
754
755
  requirements: []
755
756
  rubyforge_project:
756
- rubygems_version: 2.2.2
757
+ rubygems_version: 2.3.0
757
758
  signing_key:
758
759
  specification_version: 4
759
760
  summary: Write RSpec examples and generate coverage reports for Chef recipes!