From 303ba59a25a48f73972d5252c99034738b4a54c7 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 13 Apr 2018 19:09:10 -0700 Subject: [PATCH] Add more testing to cookbook_dir for a few more scenarios I know a few of these are going to fail, but lets do some TDD here Signed-off-by: Tim Smith --- spec/unit/linter_spec.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/spec/unit/linter_spec.rb b/spec/unit/linter_spec.rb index b8308a0b..efb25bf7 100644 --- a/spec/unit/linter_spec.rb +++ b/spec/unit/linter_spec.rb @@ -17,10 +17,14 @@ end describe "#cookbook_dir" do - it "given a root alias file the cookbook is correctly detected" do + it "given a recipe.rb root alias file the cookbook is correctly detected" do expect(linter.send(:cookbook_dir, "./cookbook/recipe.rb").to_s).to eq "cookbook" end + it "given an attributes.rb root alias file the cookbook is correctly detected" do + expect(linter.send(:cookbook_dir, "./cookbook/attributes.rb").to_s).to eq "cookbook" + end + it "given the metadata.rb file the cookbook is correctly detected" do expect(linter.send(:cookbook_dir, "./cookbook/metadata.rb").to_s).to eq "cookbook" end @@ -36,6 +40,18 @@ it "given a standard recipe file the cookbook is correctly detected" do expect(linter.send(:cookbook_dir, "./cookbook/recipes/default.rb").to_s).to eq "cookbook" end + + it "given a resource file the cookbook is correctly detected" do + expect(linter.send(:cookbook_dir, "./cookbook/resources/something.rb").to_s).to eq "cookbook" + end + + it "given a recipe named the same as a root alias recipe the cookbook is correctly detected" do + expect(linter.send(:cookbook_dir, "./cookbook/recipes/recipe.rb").to_s).to eq "cookbook" + end + + it "given an attribute named the same as a root alias attribute the cookbook is correctly detected" do + expect(linter.send(:cookbook_dir, "./cookbook/attributes/attributes.rb").to_s).to eq "cookbook" + end end describe "#check" do