Sha256: 154cc2eef6d549a331d789914ae26ba241537e13f7bf843baf7d72ece924b3c8
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 KB
Contents
require "spec_helper" describe Berkshelf::Validator do describe "#validate_files" do let(:cookbook) { double("cookbook", cookbook_name: "cookbook", path: "path") } it "raises an error when the cookbook has spaces in the files" do allow(Dir).to receive(:glob).and_return(["/there are/spaces/in this/recipes/default.rb"]) allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0.0"}) expect do subject.validate_files(cookbook) end.to raise_error(Berkshelf::InvalidCookbookFiles) end it "does not raise an error when the cookbook is valid" do allow(Dir).to receive(:glob).and_return(["/there-are/no-spaces/in-this/recipes/default.rb"]) allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0.0"}) expect do subject.validate_files(cookbook) end.to_not raise_error end it "raises an error when the cookbook version is not valid" do allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1"}) expect do subject.validate_files(cookbook) end.to raise_error end it "does not raise an error when the cookbook version is valid" do allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0"}) expect do subject.validate_files(cookbook) end.to_not raise_error end end end
Version data entries
5 entries across 5 versions & 1 rubygems