diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/recipe_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index e5dbd42f70..70164f0a9b 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -195,9 +195,7 @@ describe Chef::Recipe do describe "when cloning resources" do def expect_warning - expect(Chef::Log).to receive(:warn).with(/3694/) - expect(Chef::Log).to receive(:warn).with(/Previous/) - expect(Chef::Log).to receive(:warn).with(/Current/) + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) end it "should emit a 3694 warning when attributes change" do @@ -244,7 +242,7 @@ describe Chef::Recipe do it "should not emit a 3694 warning for completely trivial resource cloning" do recipe.zen_master "klopp" - expect(Chef::Log).to_not receive(:warn) + expect(Chef).to_not receive(:log_deprecation) recipe.zen_master "klopp" end @@ -252,7 +250,7 @@ describe Chef::Recipe do recipe.zen_master "klopp" do action :nothing end - expect(Chef::Log).to_not receive(:warn) + expect(Chef).to_not receive(:log_deprecation) recipe.zen_master "klopp" do action :score end @@ -262,7 +260,7 @@ describe Chef::Recipe do recipe.zen_master "klopp" do action :score end - expect(Chef::Log).to_not receive(:warn) + expect(Chef).to_not receive(:log_deprecation) recipe.zen_master "klopp" do action :nothing end @@ -299,6 +297,7 @@ describe Chef::Recipe do end it "will insert another resource if create_if_missing is not set (cloned resource as of Chef-12)" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) zm_resource recipe.declare_resource(:zen_master, "klopp") expect(run_context.resource_collection.count).to eql(2) @@ -421,15 +420,18 @@ describe Chef::Recipe do end it "copies attributes from the first resource" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) expect(duplicated_resource.something).to eq("bvb09") end it "does not copy the action from the first resource" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) expect(original_resource.action).to eq([:score]) expect(duplicated_resource.action).to eq([:nothing]) end it "does not copy the source location of the first resource" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) # sanity check source location: expect(original_resource.source_line).to include(__FILE__) expect(duplicated_resource.source_line).to include(__FILE__) @@ -438,10 +440,12 @@ describe Chef::Recipe do end it "sets the cookbook name on the cloned resource to that resource's cookbook" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) expect(duplicated_resource.cookbook_name).to eq("second_cb") end it "sets the recipe name on the cloned resource to that resoure's recipe" do + expect(Chef).to receive(:log_deprecation).with(/^Cloning resource attributes for zen_master\[klopp\]/) expect(duplicated_resource.recipe_name).to eq("second_recipe") end |