chefspec 0.9.0 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chefspec.rb +6 -0
- data/lib/chefspec/chef_runner.rb +14 -11
- data/lib/chefspec/matchers/execute.rb +22 -2
- data/lib/chefspec/matchers/file.rb +70 -1
- data/lib/chefspec/matchers/file_content.rb +8 -5
- data/lib/chefspec/matchers/group.rb +8 -0
- data/lib/chefspec/matchers/include_recipe.rb +6 -3
- data/lib/chefspec/matchers/log.rb +8 -1
- data/lib/chefspec/matchers/package.rb +8 -1
- data/lib/chefspec/matchers/ruby_block.rb +13 -0
- data/lib/chefspec/matchers/script.rb +17 -0
- data/lib/chefspec/matchers/shared.rb +14 -2
- data/lib/chefspec/minitest.rb +1 -0
- data/lib/chefspec/monkey_patches/lwrp_base.rb +45 -0
- data/lib/chefspec/monkey_patches/provider.rb +35 -27
- data/lib/chefspec/version.rb +1 -1
- metadata +144 -15
data/lib/chefspec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'chef'
|
2
2
|
require 'chefspec/chef_runner'
|
3
3
|
require 'chefspec/version'
|
4
|
+
|
4
5
|
if defined?(RSpec)
|
5
6
|
require 'chefspec/matchers/cron'
|
6
7
|
require 'chefspec/matchers/execute'
|
@@ -8,14 +9,19 @@ if defined?(RSpec)
|
|
8
9
|
require 'chefspec/matchers/link'
|
9
10
|
require 'chefspec/matchers/log'
|
10
11
|
require 'chefspec/matchers/package'
|
12
|
+
require 'chefspec/matchers/ruby_block'
|
11
13
|
require 'chefspec/matchers/service'
|
12
14
|
require 'chefspec/matchers/shared'
|
13
15
|
require 'chefspec/matchers/notifications'
|
14
16
|
require 'chefspec/matchers/file_content'
|
15
17
|
require 'chefspec/matchers/user'
|
18
|
+
require 'chefspec/matchers/group'
|
16
19
|
require 'chefspec/matchers/env'
|
17
20
|
require 'chefspec/matchers/include_recipe'
|
21
|
+
require 'chefspec/matchers/script'
|
18
22
|
end
|
23
|
+
|
19
24
|
require 'chefspec/minitest'
|
20
25
|
require 'chefspec/monkey_patches/hash'
|
26
|
+
require 'chefspec/monkey_patches/lwrp_base'
|
21
27
|
require 'chefspec/monkey_patches/provider'
|
data/lib/chefspec/chef_runner.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'chef'
|
2
2
|
require 'chef/client'
|
3
3
|
require 'chef/cookbook_loader'
|
4
|
+
require 'fauxhai'
|
5
|
+
|
4
6
|
require 'chefspec/matchers/shared'
|
5
7
|
|
6
8
|
# ChefSpec allows you to write rspec examples for Chef recipes to gain faster feedback without the need to converge a
|
@@ -22,16 +24,18 @@ module ChefSpec
|
|
22
24
|
# @param [Hash] options The options for the new runner
|
23
25
|
# @option options [String] :cookbook_path The path to the chef cookbook(s) to be tested.
|
24
26
|
# @option options [Symbol] :log_level The log level to use (default is :warn)
|
27
|
+
# @option options [String] :platform The platform to load Ohai attributes from (must be present in fauxhai)
|
28
|
+
# @option options [String] :version The version of the platform to load Ohai attributes from (must be present in fauxhai)
|
25
29
|
# @yield [node] Configuration block for Chef::Node
|
26
30
|
def initialize(options={})
|
27
31
|
defaults = {:cookbook_path => default_cookbook_path, :log_level => :warn, :dry_run => false, :step_into => []}
|
28
32
|
options = {:cookbook_path => options} unless options.respond_to?(:to_hash) # backwards-compatibility
|
29
|
-
options = defaults.merge(options)
|
33
|
+
@options = defaults.merge(options)
|
30
34
|
|
31
35
|
the_runner = self
|
32
36
|
@resources = []
|
33
|
-
@step_into = options[:step_into]
|
34
|
-
@do_dry_run = options[:dry_run]
|
37
|
+
@step_into = @options[:step_into]
|
38
|
+
@do_dry_run = @options[:dry_run]
|
35
39
|
|
36
40
|
Chef::Resource.class_eval do
|
37
41
|
alias :old_run_action :run_action unless method_defined?(:old_run_action)
|
@@ -69,10 +73,10 @@ module ChefSpec
|
|
69
73
|
Chef::Config[:solo] = true
|
70
74
|
Chef::Config[:cache_type] = "Memory"
|
71
75
|
Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest) }
|
72
|
-
Chef::Config[:cookbook_path] = options[:cookbook_path]
|
76
|
+
Chef::Config[:cookbook_path] = @options[:cookbook_path]
|
73
77
|
Chef::Config[:client_key] = nil
|
74
78
|
Chef::Log.verbose = true if Chef::Log.respond_to?(:verbose)
|
75
|
-
Chef::Log.level(options[:log_level])
|
79
|
+
Chef::Log.level(@options[:log_level])
|
76
80
|
@client = Chef::Client.new
|
77
81
|
fake_ohai(@client.ohai)
|
78
82
|
@client.load_node if @client.respond_to?(:load_node) # chef >= 10.14.0
|
@@ -136,13 +140,13 @@ module ChefSpec
|
|
136
140
|
# does conditional execution based on these values or additional attributes you can set these via
|
137
141
|
# node.automatic_attrs.
|
138
142
|
#
|
143
|
+
# This method now relies on fauxhai to set node attributes.
|
144
|
+
#
|
139
145
|
# @param [Ohai::System] ohai The ohai instance to set fake attributes on
|
140
146
|
def fake_ohai(ohai)
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
ohai[attribute] = value
|
145
|
-
end
|
147
|
+
::Fauxhai::Mocker.new(:platform => @options[:platform], :version => @options[:version]).data.each_pair do |attribute, value|
|
148
|
+
ohai[attribute] = value
|
149
|
+
end
|
146
150
|
end
|
147
151
|
|
148
152
|
# Infer the default cookbook path from the location of the calling spec.
|
@@ -160,7 +164,6 @@ module ChefSpec
|
|
160
164
|
def find_resource(type, name)
|
161
165
|
resources.find{|resource| resource_type(resource) == type and resource.name == name}
|
162
166
|
end
|
163
|
-
|
164
167
|
end
|
165
168
|
|
166
169
|
end
|
@@ -4,10 +4,30 @@ module ChefSpec
|
|
4
4
|
module Matchers
|
5
5
|
RSpec::Matchers.define :execute_command do |command|
|
6
6
|
match do |chef_run|
|
7
|
-
|
8
|
-
|
7
|
+
if @attributes
|
8
|
+
chef_run.resources.any? do |resource|
|
9
|
+
expected_resource?(resource,command) &&
|
10
|
+
expected_attributes?(resource)
|
11
|
+
end
|
12
|
+
else
|
13
|
+
chef_run.resources.any? do |resource|
|
14
|
+
expected_resource?(resource,command)
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
18
|
+
|
19
|
+
chain :with do |attributes|
|
20
|
+
@attributes = attributes
|
21
|
+
end
|
22
|
+
|
23
|
+
def expected_resource?(resource,command)
|
24
|
+
resource_type(resource) == 'execute' &&
|
25
|
+
resource.command == command
|
26
|
+
end
|
27
|
+
|
28
|
+
def expected_attributes?(resource)
|
29
|
+
@attributes.all? { |k,v| resource.send(k) == v }
|
30
|
+
end
|
11
31
|
end
|
12
32
|
end
|
13
33
|
end
|
@@ -4,12 +4,81 @@ module ChefSpec
|
|
4
4
|
module Matchers
|
5
5
|
|
6
6
|
define_resource_matchers([:create, :delete], [:file, :directory, :cookbook_file], :path)
|
7
|
-
define_resource_matchers([:create], [:remote_file], :path)
|
8
7
|
|
9
8
|
RSpec::Matchers.define :be_owned_by do |user, group|
|
10
9
|
match do |file|
|
11
10
|
file.nil? ? false : file.owner == user and file.group == group
|
12
11
|
end
|
13
12
|
end
|
13
|
+
|
14
|
+
RSpec::Matchers.define :create_remote_file do |path|
|
15
|
+
match do |chef_run|
|
16
|
+
if @attributes
|
17
|
+
chef_run.resources.any? do |resource|
|
18
|
+
expected_remote_file?(resource,path) &&
|
19
|
+
expected_attributes?(resource)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
chef_run.resources.any? do |resource|
|
23
|
+
expected_remote_file?(resource,path)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
chain :with do |attributes|
|
29
|
+
@attributes = attributes
|
30
|
+
end
|
31
|
+
|
32
|
+
def expected_remote_file?(resource,path)
|
33
|
+
# The resource action *might* be an array!
|
34
|
+
# (see https://tickets.opscode.com/browse/CHEF-2094)
|
35
|
+
action = resource.action.is_a?(Array) ? resource.action.first :
|
36
|
+
resource.action
|
37
|
+
resource_type(resource) == 'remote_file' &&
|
38
|
+
resource.path == path &&
|
39
|
+
action.to_sym == :create
|
40
|
+
end
|
41
|
+
|
42
|
+
def expected_attributes?(resource)
|
43
|
+
@attributes.all? do |attribute,expected|
|
44
|
+
actual = resource.send(attribute)
|
45
|
+
attribute.to_sym == :source ? equal_source?(actual, expected) :
|
46
|
+
actual == expected
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Compare two remote_file source attributes for equality.
|
51
|
+
#
|
52
|
+
# @param actual [String, Array<String>] The actual source.
|
53
|
+
# @param expected [String, Array<String>] The expected source.
|
54
|
+
# @return [Boolean] true if they are equal or false if not.
|
55
|
+
def equal_source?(actual, expected)
|
56
|
+
# NOTE: Chef stores the source attribute internally as an array since
|
57
|
+
# version 11 in order to support mirrors.
|
58
|
+
# (see http://docs.opscode.com/breaking_changes_chef_11.html#remote-file-mirror-support-may-break-subclasses)
|
59
|
+
|
60
|
+
# Handle wrong formated expectation for Chef versions >= 11.
|
61
|
+
if actual.is_a?(Array) && expected.is_a?(String)
|
62
|
+
actual == [expected]
|
63
|
+
|
64
|
+
# Handle wrong formated expectation for Chef versions < 11.
|
65
|
+
elsif actual.is_a?(String) && expected.is_a?(Array)
|
66
|
+
[actual] == expected
|
67
|
+
|
68
|
+
# Else assume the actual matches the expected type (String or Array).
|
69
|
+
else
|
70
|
+
actual == expected
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
failure_message_for_should do |actual|
|
75
|
+
message = "No remote_file named '#{path}' found"
|
76
|
+
message << " with:\n#{@attributes}" unless @attributes.nil?
|
77
|
+
end
|
78
|
+
|
79
|
+
failure_message_for_should_not do |actual|
|
80
|
+
"Found remote_file named '#{path}' that should not exist."
|
81
|
+
end
|
82
|
+
end
|
14
83
|
end
|
15
84
|
end
|
@@ -10,15 +10,18 @@ module ChefSpec
|
|
10
10
|
case resource_type(resource)
|
11
11
|
when 'template'
|
12
12
|
@actual_content = render(resource, chef_run.node)
|
13
|
-
@actual_content.to_s.include? content
|
14
13
|
when 'file'
|
15
14
|
@actual_content = resource.content
|
16
|
-
@actual_content.to_s.include? content
|
17
15
|
when 'cookbook_file'
|
18
16
|
cookbook_name = resource.cookbook || resource.cookbook_name
|
19
|
-
cookbook = chef_run.
|
17
|
+
cookbook = chef_run.run_context.cookbook_collection[cookbook_name]
|
20
18
|
@actual_content = File.read(cookbook.preferred_filename_on_disk_location(chef_run.node, :files, resource.source, resource.path))
|
21
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
if content.is_a?(Regexp)
|
22
|
+
@actual_content.to_s =~ content
|
23
|
+
else
|
24
|
+
@actual_content.to_s.include? content
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -29,4 +32,4 @@ module ChefSpec
|
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
32
|
-
end
|
35
|
+
end
|
@@ -4,13 +4,16 @@ module ChefSpec
|
|
4
4
|
module Matchers
|
5
5
|
RSpec::Matchers.define :include_recipe do |expected_recipe|
|
6
6
|
match do |chef_run|
|
7
|
-
|
8
|
-
|
7
|
+
if chef_run.run_context.respond_to?(:loaded_recipe?)
|
8
|
+
chef_run.run_context.loaded_recipe?(expected_recipe) # Chef 11+
|
9
|
+
else
|
10
|
+
chef_run.node.run_state[:seen_recipes].include?(expected_recipe) # Chef 10 and lower
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
failure_message_for_should do |chef_run|
|
12
15
|
"expected: ['#{expected_recipe}']\n" +
|
13
|
-
" got: #{chef_run.node.run_state
|
16
|
+
" got: #{chef_run.run_context.respond_to?(:loaded_recipes) ? chef_run.run_context.loaded_recipes : chef_run.node.run_state[:seen_recipes]}"
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
@@ -6,7 +6,14 @@ module ChefSpec
|
|
6
6
|
RSpec::Matchers.define :log do |message|
|
7
7
|
match do |chef_run|
|
8
8
|
chef_run.resources.any? do |resource|
|
9
|
-
resource_type(resource)
|
9
|
+
if resource_type(resource) != 'log'
|
10
|
+
false
|
11
|
+
elsif resource.respond_to?(:message)
|
12
|
+
# Chef 10.18 added message attribute to the log resource
|
13
|
+
message === resource.message
|
14
|
+
else
|
15
|
+
message === resource.name
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -4,7 +4,7 @@ module ChefSpec
|
|
4
4
|
module Matchers
|
5
5
|
|
6
6
|
CHEF_GEM_SUPPORTED = defined?(::Chef::Resource::ChefGem)
|
7
|
-
PACKAGE_TYPES = [:package, :gem_package, :chef_gem]
|
7
|
+
PACKAGE_TYPES = [:package, :gem_package, :chef_gem, :yum_package]
|
8
8
|
PACKAGE_TYPES << :chef_gem if CHEF_GEM_SUPPORTED
|
9
9
|
define_resource_matchers([:install, :remove, :upgrade, :purge], PACKAGE_TYPES, :package_name)
|
10
10
|
|
@@ -15,6 +15,13 @@ module ChefSpec
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
+
RSpec::Matchers.define :install_yum_package_at_version do |package_name, version|
|
19
|
+
match do |chef_run|
|
20
|
+
chef_run.resources.any? do |resource|
|
21
|
+
resource_type(resource) == 'yum_package' and resource.package_name == package_name and resource.action.to_s.include? 'install' and resource.version == version
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
18
25
|
RSpec::Matchers.define :install_gem_package_at_version do |package_name, version|
|
19
26
|
match do |chef_run|
|
20
27
|
chef_run.resources.any? do |resource|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'chefspec/matchers/shared'
|
2
|
+
|
3
|
+
module ChefSpec
|
4
|
+
module Matchers
|
5
|
+
RSpec::Matchers.define :execute_ruby_block do |block_name|
|
6
|
+
match do |chef_run|
|
7
|
+
chef_run.resources.any? do |resource|
|
8
|
+
resource_type(resource) == 'ruby_block' and resource.name == block_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'chefspec/matchers/shared'
|
2
|
+
|
3
|
+
module ChefSpec
|
4
|
+
module Matchers
|
5
|
+
%w(bash csh perl python ruby).each do |interpreter|
|
6
|
+
RSpec::Matchers.define "execute_#{interpreter}_script".to_sym do |name|
|
7
|
+
match do |chef_run|
|
8
|
+
chef_run.resources.any? do |resource|
|
9
|
+
(resource_type(resource) == interpreter ||
|
10
|
+
(resource_type(resource) == 'script' && resource.interpreter == interpreter)) &&
|
11
|
+
resource.name == name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -6,6 +6,14 @@ def resource_type(resource)
|
|
6
6
|
resource.resource_name.to_s
|
7
7
|
end
|
8
8
|
|
9
|
+
# Given a resource return an array of action strings
|
10
|
+
#
|
11
|
+
# @param [String] resource A Chef Resource
|
12
|
+
# @return [Array] An array of actions as Strings
|
13
|
+
def resource_actions(resource)
|
14
|
+
resource.action.kind_of?(Array) ? resource.action.map{ |action| action.to_s } : [ resource.action.to_s ]
|
15
|
+
end
|
16
|
+
|
9
17
|
# Define simple RSpec matchers for the product of resource types and actions
|
10
18
|
#
|
11
19
|
# @param [Array] actions The valid actions - for example [:create, :delete]
|
@@ -19,7 +27,7 @@ def define_resource_matchers(actions, resource_types, name_attribute)
|
|
19
27
|
accepted_types << 'template' if action.to_s == 'create' and resource_type.to_s == 'file'
|
20
28
|
chef_run.resources.any? do |resource|
|
21
29
|
accepted_types.include? resource_type(resource) and resource.send(name_attribute) == name and
|
22
|
-
resource.
|
30
|
+
resource_actions(resource).include? action.to_s
|
23
31
|
end
|
24
32
|
end
|
25
33
|
failure_message_for_should do |actual|
|
@@ -50,6 +58,10 @@ end
|
|
50
58
|
# @return [String] The path on disk
|
51
59
|
def template_path(template, node)
|
52
60
|
cookbook_name = template.cookbook || template.cookbook_name
|
53
|
-
|
61
|
+
if node.respond_to?(:run_context)
|
62
|
+
cookbook = node.run_context.cookbook_collection[cookbook_name] # Chef 11+
|
63
|
+
else
|
64
|
+
cookbook = node.cookbook_collection[cookbook_name] # Chef 10 and lower
|
65
|
+
end
|
54
66
|
cookbook.preferred_filename_on_disk_location(node, :templates, template.source)
|
55
67
|
end
|
data/lib/chefspec/minitest.rb
CHANGED
@@ -123,6 +123,7 @@ module ChefSpec
|
|
123
123
|
override_assertion :enabled, :enabled, [:disable]
|
124
124
|
override_assertion :running, :running, [:stop]
|
125
125
|
override_assertion :user_exists, :username, [:remove]
|
126
|
+
override_assertion :group_exists, :group_name, [:remove]
|
126
127
|
|
127
128
|
def file_resources
|
128
129
|
resources.select{|r| r.resource_name.to_s.end_with?('file')} +
|
@@ -0,0 +1,45 @@
|
|
1
|
+
if Chef::VERSION >= '11.0.0'
|
2
|
+
|
3
|
+
# Override Chef LWRP creation to remove existing class to avoid redefinition warnings.
|
4
|
+
class Chef
|
5
|
+
class Provider
|
6
|
+
# Chef provider for a resource
|
7
|
+
class LWRPBase < Provider
|
8
|
+
class << self
|
9
|
+
alias_method :old_build_from_file, :build_from_file
|
10
|
+
|
11
|
+
# Override Opscode provider to remove any existing LWRP
|
12
|
+
#
|
13
|
+
# @param [String] cookbook_name The name of the cookbook
|
14
|
+
# @param [String] filename File to load as a LWRP
|
15
|
+
# @param [Chef::RunContext] run_context Context of a Chef Run
|
16
|
+
# @return [Chef::Provider] the created provider
|
17
|
+
def build_from_file(*args)
|
18
|
+
cookbook_name, filename = args[0,2]
|
19
|
+
remove_existing_lwrp(convert_to_class_name(filename_to_qualified_string(cookbook_name, filename)))
|
20
|
+
old_build_from_file(*args)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Remove any existing Chef provider or resource with the specified name.
|
24
|
+
#
|
25
|
+
# @param [String] class_name The class name. Must be a valid constant name.
|
26
|
+
def remove_existing_lwrp(class_name)
|
27
|
+
[Chef::Resource::LWRPBase, Chef::Provider::LWRPBase].each do |resource_holder|
|
28
|
+
if RUBY_VERSION < '1.9'
|
29
|
+
if resource_holder.const_defined? class_name
|
30
|
+
resource_holder.send(:remove_const, class_name)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
if resource_holder.const_defined? class_name, false
|
34
|
+
resource_holder.send(:remove_const, class_name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -1,35 +1,43 @@
|
|
1
|
-
|
2
|
-
class Chef
|
3
|
-
# Chef provider for a resource
|
4
|
-
class Provider
|
5
|
-
class << self
|
6
|
-
alias_method :old_build_from_file, :build_from_file
|
1
|
+
if Chef::VERSION < '11.0.0'
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# Override Chef LWRP creation to remove existing class to avoid redefinition warnings.
|
4
|
+
class Chef
|
5
|
+
# Chef provider for a resource
|
6
|
+
class Provider
|
7
|
+
class << self
|
8
|
+
alias_method :old_build_from_file, :build_from_file
|
9
|
+
|
10
|
+
# Override Opscode provider to remove any existing LWRP
|
11
|
+
#
|
12
|
+
# @param [String] cookbook_name The name of the cookbook
|
13
|
+
# @param [String] filename File to load as a LWRP
|
14
|
+
# @param [Chef::RunContext] run_context Context of a Chef Run
|
15
|
+
# @return [Chef::Provider] the created provider
|
16
|
+
def build_from_file(*args)
|
17
|
+
cookbook_name, filename = args[0,2]
|
18
|
+
remove_existing_lwrp(convert_to_class_name(filename_to_qualified_string(cookbook_name, filename)))
|
19
|
+
old_build_from_file(*args)
|
20
|
+
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
# Remove any existing Chef provider or resource with the specified name.
|
23
|
+
#
|
24
|
+
# @param [String] class_name The class name. Must be a valid constant name.
|
25
|
+
def remove_existing_lwrp(class_name)
|
26
|
+
[Chef::Resource, Chef::Provider].each do |resource_holder|
|
27
|
+
if RUBY_VERSION < '1.9'
|
28
|
+
if resource_holder.const_defined? class_name
|
29
|
+
resource_holder.send(:remove_const, class_name)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
if resource_holder.const_defined? class_name, false
|
33
|
+
resource_holder.send(:remove_const, class_name)
|
34
|
+
end
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
29
|
-
end
|
30
38
|
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
|
-
end
|
34
|
-
|
35
42
|
|
43
|
+
end
|
data/lib/chefspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0.rc1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrew Crump
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0
|
21
|
+
version: '10.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0
|
29
|
+
version: '10.0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: erubis
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: fauxhai
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.1'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: minitest-chef-handler
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +75,22 @@ dependencies:
|
|
59
75
|
- - ~>
|
60
76
|
- !ruby/object:Gem::Version
|
61
77
|
version: 0.6.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: moneta
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - <
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.7.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - <
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.7.0
|
62
94
|
- !ruby/object:Gem::Dependency
|
63
95
|
name: rspec
|
64
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +98,7 @@ dependencies:
|
|
66
98
|
requirements:
|
67
99
|
- - ~>
|
68
100
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.
|
101
|
+
version: 2.12.0
|
70
102
|
type: :runtime
|
71
103
|
prerelease: false
|
72
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +106,103 @@ dependencies:
|
|
74
106
|
requirements:
|
75
107
|
- - ~>
|
76
108
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
109
|
+
version: 2.12.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.9.2.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.9.2.2
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: yard
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 0.8.1
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.8.1
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: aruba
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.4.11
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.4.11
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: cucumber
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ~>
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 1.2.0
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.2.0
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: i18n
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ~>
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.6.1
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ~>
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 0.6.1
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: simplecov
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ~>
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 0.7.1
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ~>
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: 0.7.1
|
78
206
|
description: Write RSpec examples for Opscode Chef recipes
|
79
207
|
email:
|
80
208
|
executables: []
|
@@ -88,16 +216,20 @@ files:
|
|
88
216
|
- lib/chefspec/matchers/execute.rb
|
89
217
|
- lib/chefspec/matchers/file.rb
|
90
218
|
- lib/chefspec/matchers/file_content.rb
|
219
|
+
- lib/chefspec/matchers/group.rb
|
91
220
|
- lib/chefspec/matchers/include_recipe.rb
|
92
221
|
- lib/chefspec/matchers/link.rb
|
93
222
|
- lib/chefspec/matchers/log.rb
|
94
223
|
- lib/chefspec/matchers/notifications.rb
|
95
224
|
- lib/chefspec/matchers/package.rb
|
225
|
+
- lib/chefspec/matchers/ruby_block.rb
|
226
|
+
- lib/chefspec/matchers/script.rb
|
96
227
|
- lib/chefspec/matchers/service.rb
|
97
228
|
- lib/chefspec/matchers/shared.rb
|
98
229
|
- lib/chefspec/matchers/user.rb
|
99
230
|
- lib/chefspec/minitest.rb
|
100
231
|
- lib/chefspec/monkey_patches/hash.rb
|
232
|
+
- lib/chefspec/monkey_patches/lwrp_base.rb
|
101
233
|
- lib/chefspec/monkey_patches/provider.rb
|
102
234
|
- lib/chefspec/version.rb
|
103
235
|
- lib/chefspec.rb
|
@@ -116,21 +248,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
248
|
version: '0'
|
117
249
|
segments:
|
118
250
|
- 0
|
119
|
-
hash:
|
251
|
+
hash: 1519435046451309777
|
120
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
253
|
none: false
|
122
254
|
requirements:
|
123
|
-
- - ! '
|
255
|
+
- - ! '>'
|
124
256
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
126
|
-
segments:
|
127
|
-
- 0
|
128
|
-
hash: -3567781514066476826
|
257
|
+
version: 1.3.1
|
129
258
|
requirements: []
|
130
259
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.8.
|
260
|
+
rubygems_version: 1.8.23
|
132
261
|
signing_key:
|
133
262
|
specification_version: 3
|
134
|
-
summary: chefspec-0.
|
263
|
+
summary: chefspec-1.0.0.rc1
|
135
264
|
test_files: []
|
136
265
|
has_rdoc:
|