Created
June 24, 2014 17:47
-
-
Save slyness/5f9b9685995352c8ed39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "chefspec" | |
| require "chefspec/librarian" | |
| at_exit { ChefSpec::Coverage.report! } if ENV['COVERAGE'] | |
| def load_resource(cookbook, lwrp) | |
| require "chef/resource/lwrp_base" | |
| name = class_name_for_lwrp(cookbook, lwrp) | |
| unless Chef::Resource.const_defined?(name) | |
| Chef::Resource::LWRPBase.build_from_file( | |
| cookbook, | |
| File.join(File.dirname(__FILE__), %W{.. resources #{lwrp}.rb}), | |
| nil | |
| ) | |
| end | |
| end | |
| def load_provider(cookbook, lwrp) | |
| require "chef/provider/lwrp_base" | |
| name = class_name_for_lwrp(cookbook, lwrp) | |
| unless Chef::Provider.const_defined?(name) | |
| Chef::Provider::LWRPBase.build_from_file( | |
| cookbook, | |
| File.join(File.dirname(__FILE__), %W{.. providers #{lwrp}.rb}), | |
| nil | |
| ) | |
| end | |
| end | |
| def class_name_for_lwrp(cookbook, lwrp) | |
| require "chef/mixin/convert_to_class_name" | |
| Chef::Mixin::ConvertToClassName.convert_to_class_name( | |
| Chef::Mixin::ConvertToClassName.filename_to_qualified_string(cookbook, lwrp) | |
| ) | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a spec_helper file for Chefspec tests