summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-10-19 14:34:23 -0700
committerdanielsdeleo <dan@opscode.com>2012-10-19 14:34:23 -0700
commit0e6d00b9453bc9efe98876490c000fcf0aed7fec (patch)
tree53d89f1c828f7d1b0b6b7639d3bd27337d9082fe
parent054fed23f058c3e5e038ab47fc9a88b4796bedb7 (diff)
downloadchef-0e6d00b9453bc9efe98876490c000fcf0aed7fec.tar.gz
[CHEF-2992] add more test coverage around attributes loading
-rw-r--r--chef/spec/unit/node_spec.rb4
-rw-r--r--chef/spec/unit/run_context_spec.rb5
2 files changed, 9 insertions, 0 deletions
diff --git a/chef/spec/unit/node_spec.rb b/chef/spec/unit/node_spec.rb
index 9741f94bfb..4577d5098b 100644
--- a/chef/spec/unit/node_spec.rb
+++ b/chef/spec/unit/node_spec.rb
@@ -447,6 +447,10 @@ describe Chef::Node do
@node.ldap_replication_password.should eql("forsure")
@node.smokey.should eql("robinson")
end
+
+ it "gives a sensible error when attempting to load a missing attributes file" do
+ lambda { @node.include_attribute("nope-this::doesnt-exist") }.should raise_error(Chef::Exceptions::CookbookNotFound)
+ end
end
describe "roles" do
diff --git a/chef/spec/unit/run_context_spec.rb b/chef/spec/unit/run_context_spec.rb
index f90acd15a5..7b52cefd6d 100644
--- a/chef/spec/unit/run_context_spec.rb
+++ b/chef/spec/unit/run_context_spec.rb
@@ -60,6 +60,11 @@ describe Chef::RunContext do
@run_context.resource_collection[3].to_s.should == "cat[peanut]"
@run_context.resource_collection[4].to_s.should == "cat[fat peanut]"
end
+
+ it "loads all the attribute files in the cookbook collection" do
+ @run_context.loaded_fully_qualified_attribute?("test", "george").should be_true
+ @node[:george].should == "washington"
+ end
end
end