diff options
author | John Keiser <john@johnkeiser.com> | 2016-09-16 14:27:27 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-09-16 14:27:27 -0700 |
commit | b64b8382a07514e3f0a973937720807a66986807 (patch) | |
tree | 61d15fb1c87d595f48f7c10d101ec976bc931d62 /spec/integration/recipes | |
parent | 3682641101e07e71684f126841b8c8fbc0220ee8 (diff) | |
download | chef-b64b8382a07514e3f0a973937720807a66986807.tar.gz |
Make 12.5+ custom resources whyrun safe by default.
(This was always intended to be the case, and it's difficult
to do it yourself. We have been teaching people whyrun-safe
methods to make resources right alongside Custom Resources, as well.)
Diffstat (limited to 'spec/integration/recipes')
-rw-r--r-- | spec/integration/recipes/resource_action_spec.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb index f4f275e937..60d5831a50 100644 --- a/spec/integration/recipes/resource_action_spec.rb +++ b/spec/integration/recipes/resource_action_spec.rb @@ -17,6 +17,22 @@ module ResourceActionSpec expect(ActionJackson.succeeded).to eq true end + context "when running in whyrun mode" do + before do + Chef::Config[:why_run] = true + end + + it "the default action runs" do + converge <<-EOM, __FILE__, __LINE__ + 1 + #{resource_dsl} "hi" do + foo "foo!" + end + EOM + expect(ActionJackson.ran_action).to eq :access_recipe_dsl + expect(ActionJackson.succeeded).to eq true + end + end + it "the action can access recipe DSL" do converge <<-EOM, __FILE__, __LINE__ + 1 #{resource_dsl} "hi" do @@ -141,7 +157,7 @@ module ResourceActionSpec action :access_recipe_dsl do ActionJackson.ran_action = :access_recipe_dsl - ruby_block "hi there" do + whyrun_safe_ruby_block "hi there" do block do ActionJackson.succeeded = true end |