chefspec 4.2.0.beta.1 → 4.2.0

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: 68b2b322b2293fa631345ed68a61262d0f46d943
4
- data.tar.gz: 99a905d8ea24d4c6d20f554c8bc0f42d5f60f14f
3
+ metadata.gz: 75d0edf1b239bc0e3f2925b5369b05446c94e5af
4
+ data.tar.gz: 05c29cdc3052844db10148b184b9b8476c88c016
5
5
  SHA512:
6
- metadata.gz: 07409059ef229f4eb9e2e7f9fe3d4f1d9db2b9e859f0864fbc29df6ed89fddf1e60788e9d7808aae2c853d6ed52163be242ecb99b55ff410327a958b95310883
7
- data.tar.gz: 7153ec068c65759290deadf4183d3a57693b092a531118ce4b3f1294f2fa4b2d056202ff2fa4f3c83397db7fc9bb5d2fb92c1a4f5b02fc502d612500c39a8c37
6
+ metadata.gz: fddcc55b0216f17d1d39eb0c8d5515a2efd09eb8f9db6e7ffc4affcc2c4c2f4c140d8e3a4abca91404b96040e8a3d5596dac00e5314fe617f7fd3c7df58fbe9d
7
+ data.tar.gz: 49e6647e765e13381955b457ac19df13f000f974344030648356afc589ee1c646676a40033bf667df0f1f274b4a62cb9e9eda38b48eadaf437628e962435be7e
@@ -1,5 +1,6 @@
1
+ sudo: false
2
+
1
3
  rvm:
2
- - 1.9.3
3
4
  - 2.0.0
4
5
  - 2.1
5
6
 
@@ -16,12 +17,12 @@ notifications:
16
17
  template:
17
18
  - "%{message} (%{author}): %{build_url}"
18
19
 
19
- bundler_args: --jobs 7
20
+ bundler_args: --jobs 7 --retry 3
20
21
 
21
22
  gemfile:
22
23
  - gemfiles/chef-11.14.0.gemfile
23
24
  - gemfiles/chef-11.16.0.gemfile
24
- - gemfiles/chef-12.0.0.rc.gemfile
25
+ - gemfiles/chef-12.0.0.gemfile
25
26
  - gemfiles/chef-master.gemfile
26
27
 
27
28
  matrix:
@@ -1,7 +1,7 @@
1
1
  CHANGELOG for ChefSpec
2
2
  ======================
3
3
 
4
- ## 4.2.0.beta.1 (November 5, 2014)
4
+ ## 4.2.0 (December 25, 2014)
5
5
  Bugfixes:
6
6
  - Updated README grep examples
7
7
  - Fix various typographical errors
@@ -10,6 +10,9 @@ Bugfixes:
10
10
  Improvements:
11
11
  - Add support for Chef 12
12
12
  - Added support for environments in Chef Solo
13
+ - Fix location definition for caching
14
+ - Allow passing `Chef::Config[:file_cache_path]` from outside
15
+ - Update support for Chef 12
13
16
 
14
17
  ## 4.1.1 (October 13, 2014)
15
18
  Bugfixes:
data/README.md CHANGED
@@ -110,6 +110,12 @@ ChefSpec::SoloRunner.new(platform: 'centos', version: '5.10')
110
110
  # Specify a different cookbook_path
111
111
  ChefSpec::SoloRunner.new(cookbook_path: '/var/my/other/path', role_path: '/var/my/roles')
112
112
 
113
+ # By default ChefSpec sets a new temporary directory for file caching in every run.
114
+ # This can be overridden by passing the `file_cache_path` option.
115
+ # Note: Resources containing `Chef::Config[:file_cache_path]` in their name or
116
+ # attributes, will fail unless this option is specified.
117
+ ChefSpec::SoloRunner.new(file_cache_path: '/var/chef/cache')
118
+
113
119
  # Add debug log output
114
120
  ChefSpec::SoloRunner.new(log_level: :debug).converge(described_recipe)
115
121
  ```
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'chef', '~> 11.14.0'
4
4
 
5
- gemspec :path => '..'
5
+ gemspec path: '..'
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'chef', '~> 11.16.0'
4
4
 
5
- gemspec :path => '..'
5
+ gemspec path: '..'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'chef', '~> 12.0.0'
4
+
5
+ gemspec path: '..'
@@ -34,7 +34,10 @@ module ChefSpec
34
34
  FINALIZER = lambda { |id| @@cache.delete(id) }
35
35
 
36
36
  def cached(name, &block)
37
- location = ancestors.first.metadata[:location]
37
+ location = ancestors.first.metadata[:location]
38
+ unless ancestors.first.metadata[:description].nil? || location.nil?
39
+ location += ancestors.first.metadata[:description]
40
+ end
38
41
  location ||= ancestors.first.metadata[:parent_example_group][:location]
39
42
 
40
43
  define_method(name) do
@@ -16,12 +16,12 @@ end
16
16
 
17
17
  module ChefSpec
18
18
  class Runner
19
- # @deprecated {ChefSpec.define_runner_method} is deprecated. Please
20
- # use {ChefSpec.define_runner_method} instead.
19
+ # @deprecated {ChefSpec::Runner.define_runner_method} is deprecated. Please
20
+ # use {ChefSpec.define_matcher} instead.
21
21
  def self.define_runner_method(resource_name)
22
- deprecated "`ChefSpec::Runner.define_runner_method' is deprecated. " \
23
- "It is being used in the #{resource_name} resource matcher." \
24
- "Please use `ChefSpec.define_matcher' instead."
22
+ deprecated "`ChefSpec::Runner.define_runner_method' is deprecated." \
23
+ " It is being used in the #{resource_name} resource matcher." \
24
+ " Please use `ChefSpec.define_matcher' instead."
25
25
 
26
26
  ChefSpec.define_matcher(resource_name)
27
27
  end
@@ -1,3 +1,10 @@
1
+ # Force loading Chef Config to fix a bad dependency tree. See
2
+ # https://github.com/opscode/chef/issues/2703 for more information.
3
+ require 'chef/config'
4
+
5
+ # Providers has to be included before client... probably a weird
6
+ # include missing in Chef-land, but we can make sure we get it right anyway.
7
+ require 'chef/providers'
1
8
  require 'chef/client'
2
9
 
3
10
  # @private
@@ -119,7 +119,9 @@ module ChefSpec
119
119
  #
120
120
  # @return [Array<Chef::Cookbook>]
121
121
  def cookbook_collection(node)
122
- if node.respond_to?(:run_context)
122
+ if chef_run.respond_to?(:run_context)
123
+ chef_run.run_context.cookbook_collection # Chef 11.8+
124
+ elsif node.respond_to?(:run_context)
123
125
  node.run_context.cookbook_collection # Chef 11+
124
126
  else
125
127
  node.cookbook_collection # Chef 10
@@ -56,7 +56,14 @@ module ChefSpec
56
56
  # @see (SoloRunner#converge)
57
57
  def converge(*recipe_names)
58
58
  upload_cookbooks!
59
- super
59
+
60
+ super do
61
+ yield if block_given?
62
+
63
+ # Save the node back to the server for searching purposes
64
+ client.register
65
+ node.save
66
+ end
60
67
  end
61
68
 
62
69
  private
@@ -56,6 +56,8 @@ module ChefSpec
56
56
  # Path of a json file that will be passed to fauxhai as :path option
57
57
  # @option options [Array<String>] :step_into
58
58
  # The list of LWRPs to evaluate
59
+ # @option options String] :file_cache_path
60
+ # File caching path, if absent ChefSpec will use a temporary directory generated on the fly
59
61
  #
60
62
  # @yield [node] Configuration block for Chef::Node
61
63
  #
@@ -71,7 +73,7 @@ module ChefSpec
71
73
  Chef::Config[:client_key] = nil
72
74
  Chef::Config[:client_name] = nil
73
75
  Chef::Config[:node_name] = nil
74
- Chef::Config[:file_cache_path] = file_cache_path
76
+ Chef::Config[:file_cache_path] = @options[:file_cache_path] || file_cache_path
75
77
  Chef::Config[:cookbook_path] = Array(@options[:cookbook_path])
76
78
  Chef::Config[:no_lazy_load] = true
77
79
  Chef::Config[:role_path] = Array(@options[:role_path])
@@ -109,12 +111,6 @@ module ChefSpec
109
111
  # Expand the run_list
110
112
  expand_run_list!
111
113
 
112
- # Save the node back to the server for searching purposes
113
- unless Chef::Config[:solo]
114
- client.register
115
- node.save
116
- end
117
-
118
114
  # Setup the run_context
119
115
  @run_context = client.setup_run_context
120
116
 
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '4.2.0.beta.1'
2
+ VERSION = '4.2.0'
3
3
  end
@@ -15,9 +15,9 @@ describe ChefSpec::Runner do
15
15
 
16
16
  it 'prints a deprecation' do
17
17
  expect(ChefSpec::Runner).to receive(:deprecated)
18
- .with("`ChefSpec::Runner.define_runner_method' is deprecated. "\
19
- "It is being used in the my_custom_resource resource matcher." \
20
- "Please use `ChefSpec.define_matcher' instead.")
18
+ .with("`ChefSpec::Runner.define_runner_method' is deprecated."\
19
+ " It is being used in the my_custom_resource resource matcher." \
20
+ " Please use `ChefSpec.define_matcher' instead.")
21
21
  ChefSpec::Runner.define_runner_method(:my_custom_resource)
22
22
  end
23
23
 
@@ -60,6 +60,11 @@ describe ChefSpec::SoloRunner do
60
60
  expect(Chef::Config.cookbook_path).to eq(['/tmp/bacon'])
61
61
  end
62
62
 
63
+ it 'sets the file cache path' do
64
+ described_class.new( file_cache_path: '/tmp/pantoa')
65
+ expect(Chef::Config.file_cache_path).to eq('/tmp/pantoa')
66
+ end
67
+
63
68
  it 'sets the Chef::Config' do
64
69
  expect(Chef::Config.cache_type).to eq('Memory')
65
70
  expect(Chef::Config.force_logger).to be_truthy
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.2.0.beta.1
4
+ version: 4.2.0
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-11-06 00:00:00.000000000 Z
12
+ date: 2014-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -285,8 +285,6 @@ files:
285
285
  - examples/include_recipe/recipes/not.rb
286
286
  - examples/include_recipe/recipes/other.rb
287
287
  - examples/include_recipe/spec/default_spec.rb
288
- - examples/inherits/recipes/default.rb
289
- - examples/inherits/spec/default_spec.rb
290
288
  - examples/ips_package/recipes/install.rb
291
289
  - examples/ips_package/recipes/remove.rb
292
290
  - examples/ips_package/recipes/upgrade.rb
@@ -560,7 +558,6 @@ files:
560
558
  - features/http_request.feature
561
559
  - features/ifconfig.feature
562
560
  - features/include_recipe.feature
563
- - features/inherits.feature
564
561
  - features/ips_package.feature
565
562
  - features/link.feature
566
563
  - features/log.feature
@@ -606,7 +603,7 @@ files:
606
603
  - features/yum_package.feature
607
604
  - gemfiles/chef-11.14.0.gemfile
608
605
  - gemfiles/chef-11.16.0.gemfile
609
- - gemfiles/chef-12.0.0.rc.gemfile
606
+ - gemfiles/chef-12.0.0.gemfile
610
607
  - gemfiles/chef-master.gemfile
611
608
  - lib/chefspec.rb
612
609
  - lib/chefspec/api.rb
@@ -756,9 +753,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
756
753
  version: '1.9'
757
754
  required_rubygems_version: !ruby/object:Gem::Requirement
758
755
  requirements:
759
- - - ">"
756
+ - - ">="
760
757
  - !ruby/object:Gem::Version
761
- version: 1.3.1
758
+ version: '0'
762
759
  requirements: []
763
760
  rubyforge_project:
764
761
  rubygems_version: 2.2.2
@@ -794,7 +791,6 @@ test_files:
794
791
  - features/http_request.feature
795
792
  - features/ifconfig.feature
796
793
  - features/include_recipe.feature
797
- - features/inherits.feature
798
794
  - features/ips_package.feature
799
795
  - features/link.feature
800
796
  - features/log.feature
@@ -1,5 +0,0 @@
1
- directory '/tmp/inherit'
2
-
3
- directory '/tmp/no_inherit' do
4
- inherits false
5
- end
@@ -1,21 +0,0 @@
1
- require 'chefspec'
2
-
3
- describe 'inherits::default' do
4
- let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
5
-
6
- it 'allows use of the `inherits` attribute even on non-Windows' do
7
- expect {
8
- chef_run
9
- }.to_not raise_error
10
- end
11
-
12
- it 'matches on the default inherits attribute' do
13
- expect(chef_run).to create_directory('/tmp/inherit')
14
- expect(chef_run).to_not create_directory('/tmp/not_inherit')
15
- end
16
-
17
- it 'matches on the inherits attribute' do
18
- expect(chef_run).to create_directory('/tmp/no_inherit').with(inherits: false)
19
- expect(chef_run).to_not create_directory('/tmp/no_inherit').with(inherits: true)
20
- end
21
- end
@@ -1,8 +0,0 @@
1
- @not_chef_12_0_0_rc_0
2
- Feature: The inherits matcher
3
- Background:
4
- * I am using the "inherits" cookbook
5
-
6
- Scenario: Running specs
7
- * I successfully run `rspec spec/default_spec.rb`
8
- * the output should contain "0 failures"
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'chef', '~> 12.0.0.rc'
4
-
5
- gemspec :path => '..'