diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-07-01 11:25:29 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-07-01 11:25:29 -0700 |
commit | 0bdd358decddf4251c20ced1eb48e54057eb2418 (patch) | |
tree | 8b14ee89ad80558f59b8acea81ef6e7c5863f1fd /spec/unit/recipe_spec.rb | |
parent | a39ae423bbfc72f4b26c4ed2435c4b625e176e6e (diff) | |
download | chef-0bdd358decddf4251c20ced1eb48e54057eb2418.tar.gz |
tweak 3694 warnings
- clean up "ZenMaster" resource
- clean up 3694 detection to use properties
- unlazy the resource_name in the trivial resource check
- fixes an issue with resources-as-definitions pattern emitting
3694 errors for trivial resources
Diffstat (limited to 'spec/unit/recipe_spec.rb')
-rw-r--r-- | spec/unit/recipe_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 70164f0a9b..3c30f96b20 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -266,6 +266,27 @@ describe Chef::Recipe do end end + class Coerced < Chef::Resource + resource_name :coerced + provides :coerced + default_action :whatever + property :package_name, [String, Array], coerce: proc { |x| [x].flatten }, name_property: true + def after_created + Array(action).each do |action| + run_action(action) + end + end + action :whatever do + package_name # unlazy the package_name + end + end + + it "does not emit 3694 when the name_property is unlazied by running it at compile_time" do + recipe.coerced "string" + expect(Chef).to_not receive(:log_deprecation) + recipe.coerced "string" + end + it "validating resources via build_resource" do expect {recipe.build_resource(:remote_file, "klopp") do source Chef::DelayedEvaluator.new { "http://chef.io" } |