Module: ChefSpec
- Defined in:
- lib/chefspec/chef_backwards_compat.rb,
lib/chefspec.rb,
lib/chefspec/api.rb,
lib/chefspec/util.rb,
lib/chefspec/cacher.rb,
lib/chefspec/errors.rb,
lib/chefspec/macros.rb,
lib/chefspec/version.rb,
lib/chefspec/coverage.rb,
lib/chefspec/matchers.rb,
lib/chefspec/renderer.rb,
lib/chefspec/berkshelf.rb,
lib/chefspec/formatter.rb,
lib/chefspec/librarian.rb,
lib/chefspec/policyfile.rb,
lib/chefspec/stubs/stub.rb,
lib/chefspec/solo_runner.rb,
lib/chefspec/deprecations.rb,
lib/chefspec/server_runner.rb,
lib/chefspec/server_methods.rb,
lib/chefspec/stubs/registry.rb,
lib/chefspec/coverage/filters.rb,
lib/chefspec/mixins/normalize.rb,
lib/chefspec/stubs/search_stub.rb,
lib/chefspec/stubs/command_stub.rb,
lib/chefspec/stubs/data_bag_stub.rb,
lib/chefspec/file_cache_path_proxy.rb,
lib/chefspec/stubs/search_registry.rb,
lib/chefspec/stubs/command_registry.rb,
lib/chefspec/stubs/data_bag_registry.rb,
lib/chefspec/stubs/data_bag_item_stub.rb,
lib/chefspec/stubs/data_bag_item_registry.rb,
lib/chefspec/expect_exception.rb
Overview
This file contains the backwards compatible hacks required to make ChefSpec work with the previous version of Chef. ChefSpec only promises to be backwards compatible with the last major release of Chef, but it may work with earlier versions.
The hacks are kept in this file so as to avoid a bunch of branching logic throughout the codebase. It also makes dropping backwards compatability much easier without the risk of breaking things.
This file must be loaded AFTER the rest of ChefSpec has been initialized!
Defined Under Namespace
Modules: API, Cacher, Error, Macros, Matchers, Normalize, RemoveExistingLWRP, ServerMethods, Stubs, Util Classes: Berkshelf, ChefFormatter, Coverage, ExpectException, FileCachePathProxy, Librarian, Policyfile, Renderer, Runner, Server, ServerRunner, SoloRunner
Constant Summary collapse
- VERSION =
'5.3.0'
Class Method Summary collapse
-
.define_matcher(resource_name) ⇒ self
Defines a new runner method on the Chef runner.
-
.matchers ⇒ Hash<String, Proc>
The list of custom defined matchers.
-
.root ⇒ Pathname
The source root of the ChefSpec gem.
Class Method Details
.define_matcher(resource_name) ⇒ self
Defines a new runner method on the Chef runner.
12 13 14 15 16 17 18 |
# File 'lib/chefspec.rb', line 12 def define_matcher(resource_name) matchers[resource_name.to_sym] = Proc.new do |identity| find_resource(resource_name, identity) end self end |
.matchers ⇒ Hash<String, Proc>
The list of custom defined matchers.
39 40 41 |
# File 'lib/chefspec.rb', line 39 def matchers @matchers ||= {} end |
.root ⇒ Pathname
The source root of the ChefSpec gem. This is useful when requiring files that are relative to the root of the project.
27 28 29 |
# File 'lib/chefspec.rb', line 27 def root @root ||= Pathname.new(File.('../../', __FILE__)) end |