diff options
Diffstat (limited to 'spec/unit/cookbook_spec.rb')
-rw-r--r-- | spec/unit/cookbook_spec.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/spec/unit/cookbook_spec.rb b/spec/unit/cookbook_spec.rb index 33b4a3ccd8..ac3a1373ea 100644 --- a/spec/unit/cookbook_spec.rb +++ b/spec/unit/cookbook_spec.rb @@ -19,7 +19,8 @@ require "spec_helper" describe Chef::CookbookVersion do -# COOKBOOK_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks", "openldap")) + COOKBOOK_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks", "openldap")) + before(:each) do @cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks")) cl = Chef::CookbookLoader.new(@cookbook_repo) @@ -37,26 +38,21 @@ describe Chef::CookbookVersion do end it "should allow you to set the list of attribute files and create the mapping from short names to paths" do - @cookbook.attribute_filenames = [ "attributes/one.rb", "attributes/two.rb" ] - expect(@cookbook.attribute_filenames).to eq([ "attributes/one.rb", "attributes/two.rb" ]) - expect(@cookbook.attribute_filenames_by_short_filename.keys.sort).to eql(%w{one two}) - expect(@cookbook.attribute_filenames_by_short_filename["one"]).to eq("attributes/one.rb") - expect(@cookbook.attribute_filenames_by_short_filename["two"]).to eq("attributes/two.rb") + expect(@cookbook.attribute_filenames_by_short_filename.keys.sort).to eql(%w{default smokey}) + expect(@cookbook.attribute_filenames_by_short_filename["default"]).to eq(File.join(COOKBOOK_PATH, "attributes/default.rb")) + expect(@cookbook.attribute_filenames_by_short_filename["smokey"]).to eq(File.join(COOKBOOK_PATH, "attributes/smokey.rb")) end it "should allow you to set the list of recipe files and create the mapping of recipe short name to filename" do - @cookbook.recipe_filenames = [ "recipes/one.rb", "recipes/two.rb" ] - expect(@cookbook.recipe_filenames).to eq([ "recipes/one.rb", "recipes/two.rb" ]) - expect(@cookbook.recipe_filenames_by_name.keys.sort).to eql(%w{one two}) - expect(@cookbook.recipe_filenames_by_name["one"]).to eq("recipes/one.rb") - expect(@cookbook.recipe_filenames_by_name["two"]).to eq("recipes/two.rb") + expect(@cookbook.recipe_filenames_by_name.keys.sort).to eql(%w{default gigantor one return}) + expect(@cookbook.recipe_filenames_by_name["one"]).to eq(File.join(COOKBOOK_PATH, "recipes/one.rb")) + expect(@cookbook.recipe_filenames_by_name["gigantor"]).to eq(File.join(COOKBOOK_PATH, "recipes/gigantor.rb")) end it "should generate a list of recipes by fully-qualified name" do - @cookbook.recipe_filenames = [ "recipes/one.rb", "/recipes/two.rb", "three.rb" ] expect(@cookbook.fully_qualified_recipe_names.include?("openldap::one")).to eq(true) - expect(@cookbook.fully_qualified_recipe_names.include?("openldap::two")).to eq(true) - expect(@cookbook.fully_qualified_recipe_names.include?("openldap::three")).to eq(true) + expect(@cookbook.fully_qualified_recipe_names.include?("openldap::gigantor")).to eq(true) + expect(@cookbook.fully_qualified_recipe_names.include?("openldap::return")).to eq(true) end it "should raise an ArgumentException if you try to load a bad recipe name" do |