summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Danna <steve@opscode.com>2012-12-12 01:21:29 -0800
committerBryan McLellan <btm@opscode.com>2013-04-18 09:06:04 -0700
commita7695e929ed6b90649cda4440a6e67e834284386 (patch)
tree37d5642b38e7b6fba62e718aacea8c3153910f7c
parent169ac3cb551c84cdc389b3a97a3b24e943dd0087 (diff)
downloadchef-a7695e929ed6b90649cda4440a6e67e834284386.tar.gz
[CHEF-2467] Add tests and fix grammar.
-rw-r--r--chef/spec/unit/shef/shef_session_spec.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/chef/spec/unit/shef/shef_session_spec.rb b/chef/spec/unit/shef/shef_session_spec.rb
index 73f76321f2..c994b451f1 100644
--- a/chef/spec/unit/shef/shef_session_spec.rb
+++ b/chef/spec/unit/shef/shef_session_spec.rb
@@ -47,6 +47,19 @@ describe Shef::ShefSession do
end
+describe Shef::ClientSession do
+ it "builds the node's run_context with the proper environment" do
+ @session = Shef::ClientSession.instance
+ @node = Chef::Node.build("foo")
+ @session.node = @node
+ @session.instance_variable_set(:@client, stub(:sync_cookbooks => {}))
+ @expansion = Chef::RunList::RunListExpansion.new(@node.chef_environment, [])
+
+ @node.run_list.should_receive(:expand).with(@node.chef_environment).and_return(@expansion)
+ @session.rebuild_context
+ end
+end
+
describe Shef::StandAloneSession do
before do
@session = Shef::StandAloneSession.instance
@@ -102,14 +115,14 @@ describe Shef::SoloSession do
Chef::Config[:shef_solo] = nil
end
- it "returns a collection based on it's compilation object and the extra recipe provided by shef" do
+ it "returns a collection based on its compilation object and the extra recipe provided by shef" do
@session.stub!(:node_built?).and_return(true)
kitteh = Chef::Resource::Cat.new("keyboard")
@recipe.run_context.resource_collection << kitteh
@session.resource_collection.should include(kitteh)
end
- it "returns definitions from it's compilation object" do
+ it "returns definitions from its compilation object" do
@session.definitions.should == @run_context.definitions
end
@@ -119,7 +132,7 @@ describe Shef::SoloSession do
#pending "1) keep attribs in an ivar 2) pass them to the node 3) feed them to the node on reset"
end
- it "generates it's resource collection from the compiled cookbooks and the ad hoc recipe" do
+ it "generates its resource collection from the compiled cookbooks and the ad hoc recipe" do
@session.stub!(:node_built?).and_return(true)
kitteh_cat = Chef::Resource::Cat.new("kitteh")
@run_context.resource_collection << kitteh_cat