summaryrefslogtreecommitdiff
path: root/chef-utils/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-01-30 15:13:11 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2020-01-30 15:13:11 -0800
commitda82e9c737a594e619943c8f32e6368e6bb85fce (patch)
tree3335bd04284ccb7aa8744cb3a2ea3ac14126a891 /chef-utils/spec
parentbe64e7f89b4b027061acf8afeea9b9b981856dc4 (diff)
downloadchef-da82e9c737a594e619943c8f32e6368e6bb85fce.tar.gz
Add chef-sugar include_recipe? helper
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'chef-utils/spec')
-rw-r--r--chef-utils/spec/unit/dsl/introspection_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/chef-utils/spec/unit/dsl/introspection_spec.rb b/chef-utils/spec/unit/dsl/introspection_spec.rb
index d45a3c6000..8457f06630 100644
--- a/chef-utils/spec/unit/dsl/introspection_spec.rb
+++ b/chef-utils/spec/unit/dsl/introspection_spec.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2018-2019, Chef Software Inc.
+# Copyright:: Copyright 2018-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -165,4 +165,23 @@ RSpec.describe ChefUtils::DSL::Introspection do
end
end
end
+
+ context "#include_recipe?" do
+ it "is true when the recipe has been seen by the node" do
+ expect(node).to receive(:recipe?).with("myrecipe").and_return(true)
+ expect(ChefUtils.include_recipe?("myrecipe", node)).to be true
+ end
+ it "is false when the recipe has not been seen by the node" do
+ expect(node).to receive(:recipe?).with("myrecipe").and_return(false)
+ expect(ChefUtils.include_recipe?("myrecipe", node)).to be false
+ end
+ it "the alias is true when the recipe has been seen by the node" do
+ expect(node).to receive(:recipe?).with("myrecipe").and_return(true)
+ expect(ChefUtils.includes_recipe?("myrecipe", node)).to be true
+ end
+ it "the alias is false when the recipe has not been seen by the node" do
+ expect(node).to receive(:recipe?).with("myrecipe").and_return(false)
+ expect(ChefUtils.includes_recipe?("myrecipe", node)).to be false
+ end
+ end
end