summaryrefslogtreecommitdiff
path: root/spec/unit/run_context
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-06-10 12:25:25 -0700
committerJohn Keiser <john@johnkeiser.com>2015-06-23 14:42:28 -0700
commit1f7f5577cc5cc89d210d6b3578132e2c391d1aca (patch)
treecb9bc6bdd0e887aa7546cdbb750452867934fc5c /spec/unit/run_context
parent54a0d0d6df9ca93eb6c0116e0d8c5865a098bfe4 (diff)
downloadchef-1f7f5577cc5cc89d210d6b3578132e2c391d1aca.tar.gz
Make load/include recipe run in child contextjk/resource_actions
Diffstat (limited to 'spec/unit/run_context')
-rw-r--r--spec/unit/run_context/child_run_context_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/run_context/child_run_context_spec.rb b/spec/unit/run_context/child_run_context_spec.rb
index 4651bd2737..63586e459c 100644
--- a/spec/unit/run_context/child_run_context_spec.rb
+++ b/spec/unit/run_context/child_run_context_spec.rb
@@ -101,6 +101,33 @@ describe Chef::RunContext::ChildRunContext do
c = child.create_child
expect(c.parent_run_context).to eq child
end
+
+ context "after load('include::default')" do
+ before do
+ run_list = Chef::RunList.new('include::default').expand('_default')
+ # TODO not sure why we had to do this to get everything to work ...
+ node.automatic_attrs[:recipes] = []
+ child.load(run_list)
+ end
+
+ it "load_recipe loads into the child" do
+ expect(child.resource_collection).to be_empty
+ child.load_recipe("include::includee")
+ expect(child.resource_collection).not_to be_empty
+ end
+
+ it "include_recipe loads into the child" do
+ expect(child.resource_collection).to be_empty
+ child.include_recipe("include::includee")
+ expect(child.resource_collection).not_to be_empty
+ end
+
+ it "load_recipe_file loads into the child" do
+ expect(child.resource_collection).to be_empty
+ child.load_recipe_file(File.expand_path("include/recipes/includee.rb", chef_repo_path))
+ expect(child.resource_collection).not_to be_empty
+ end
+ end
end
end
end