Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Add more testing to cookbook_dir for a few more scenarios #756

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion spec/unit/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down