summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@opscode.com>2011-09-29 07:05:20 -0700
committerBryan McLellan <btm@opscode.com>2011-09-29 07:05:20 -0700
commitaa8931125c7529c7be938bc7d1ac8b2bbfe1c45a (patch)
tree842bd5249ae6714ccce2c9342c4aebc89ec46529
parent16a45a40257816bfc4535c100ad743ca201356a1 (diff)
downloadchef-aa8931125c7529c7be938bc7d1ac8b2bbfe1c45a.tar.gz
CHEF-1958: Fix up and add a spec
-rw-r--r--chef/spec/unit/cookbook_version_spec.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/chef/spec/unit/cookbook_version_spec.rb b/chef/spec/unit/cookbook_version_spec.rb
index b2acb3eb04..c7457bf4a9 100644
--- a/chef/spec/unit/cookbook_version_spec.rb
+++ b/chef/spec/unit/cookbook_version_spec.rb
@@ -265,11 +265,21 @@ describe Chef::CookbookVersion do
readme["specificity"].should == "default"
end
- it "raises an error when attempting to load a missing cookbook_file" do
- node = Chef::Node.new.tap {|n| n.name("sample.node"); n[:fqdn] = "sample.example.com"; n[:platform] = "ubuntu"; n[:platform_version] = "10.04"}
- attempt_to_load_file = lambda { @cookbook_version.preferred_manifest_record(node, :files, "no-such-thing.txt") }
- useful_explanation = Regexp.new(Regexp.escape("Cookbook 'tatft' (0.0.0) does not contain file 'files/default/no-such-thing.txt'"))
- attempt_to_load_file.should raise_error(Chef::Exceptions::FileNotFound, useful_explanation)
+ describe "raises an error when attempting to load a missing cookbook_file and" do
+ before do
+ node = Chef::Node.new.tap {|n| n.name("sample.node"); n[:fqdn] = "sample.example.com"; n[:platform] = "ubuntu"; n[:platform_version] = "10.04"}
+ @attempt_to_load_file = lambda { @cookbook_version.preferred_manifest_record(node, :files, "no-such-thing.txt") }
+ end
+
+ it "describes the cookbook and version" do
+ useful_explanation = Regexp.new(Regexp.escape("Cookbook 'tatft' (0.0.0) does not contain"))
+ @attempt_to_load_file.should raise_error(Chef::Exceptions::FileNotFound, useful_explanation)
+ end
+
+ it "lists suggested places to look" do
+ useful_explanation = Regexp.new(Regexp.escape("files/default/no-such-thing.txt"))
+ @attempt_to_load_file.should raise_error(Chef::Exceptions::FileNotFound, useful_explanation)
+ end
end
end