diff options
| author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
|---|---|---|
| committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
| commit | 8a7e29d52882c39d0c903eef83bd3472e4f334af (patch) | |
| tree | a25a7b76416e07ebdb54e569fb0006079cf012db /spec/unit/dsl | |
| parent | c31625406530b560fab02b11fa2447955ed2faef (diff) | |
| download | chef-8a7e29d52882c39d0c903eef83bd3472e4f334af.tar.gz | |
Add chef-utils gem with various recipe DSL helpers
This is the implementation of [RFC-087](https://github.com/chef-boneyard/chef-rfc/blob/master/rfc087-distro-sugar-helpers.md)
although some of the specifics have been iterated on and changed.
The documentation will be in the [README.md](https://github.com/chef/chef/tree/master/chef-utils/README.md) once this is merged.
While this PR mostly moves chef-sugar utilities into core-chef via this chef-utils gem, the scope of the chef-utils gem
should be considered larger than just that. As an example this PR moves the Mash class into this gem for reuse in ohai
as well.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/dsl')
| -rw-r--r-- | spec/unit/dsl/platform_introspection_spec.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/unit/dsl/platform_introspection_spec.rb b/spec/unit/dsl/platform_introspection_spec.rb index 7af233a769..227585a889 100644 --- a/spec/unit/dsl/platform_introspection_spec.rb +++ b/spec/unit/dsl/platform_introspection_spec.rb @@ -1,6 +1,6 @@ # # Author:: Seth Falcon (<seth@chef.io>) -# Copyright:: Copyright 2010-2016, Chef Software Inc. +# Copyright:: Copyright 2010-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -127,3 +127,33 @@ describe Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue do end end + +describe "ChefHelper functions mixed into classes" do + METHODS = %i{windows? fedora_derived? bsd_based? rhel? aix? gentoo?}.freeze + + METHODS.each do |method| + it "mixes #{method} into Chef::Resource instances" do + expect(Chef::Resource.instance_methods.include?(method)).to be true + end + + it "mixes #{method} into Chef::Resource classes (provides lines, etc)" do + expect(Chef::Resource.respond_to?(method)).to be true + end + + it "mixes #{method} into Chef::Provider instances (actions)" do + expect(Chef::Provider.instance_methods.include?(method)).to be true + end + + it "mixes #{method} into Chef::Provider classes (provides lines, etc)" do + expect(Chef::Provider.respond_to?(method)).to be true + end + + it "mixes #{method} into Chef::Recipe instances (recipe files)" do + expect(Chef::Recipe.instance_methods.include?(method)).to be true + end + + it "mixes #{method} into Chef::Node instances (attribute files)" do + expect(Chef::Recipe.instance_methods.include?(method)).to be true + end + end +end |
