Sha256: 9c7332aa762ca29a1cbf924ef42275cc728ac3b6af582e4356713a960cebf7f8
Contents?: true
Size: 1.64 KB
Versions: 26
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' module Berkshelf describe PathLocation do let(:complacent_constraint) { double('comp-vconstraint', satisfies?: true) } let(:path) { fixtures_path.join("cookbooks", "example_cookbook").to_s } subject { PathLocation.new("nginx", complacent_constraint, path: path) } describe "#download" do it "returns an instance of CachedCookbook" do subject.download(tmp_path).should be_a(CachedCookbook) end it "sets the downloaded status to true" do subject.download(tmp_path) subject.should be_downloaded end context "given a path that does not exist" do subject { PathLocation.new("doesnot_exist", complacent_constraint, path: tmp_path.join("doesntexist_noway")) } it "raises a CookbookNotFound error" do lambda { subject.download(tmp_path) }.should raise_error(CookbookNotFound) end end context "given a path that does not contain a cookbook" do subject { PathLocation.new("doesnot_exist", complacent_constraint, path: fixtures_path) } it "raises a CookbookNotFound error" do lambda { subject.download(tmp_path) }.should raise_error(CookbookNotFound) end end context "given the content at path does not satisfy the version constraint" do subject { PathLocation.new("nginx", double('constraint', satisfies?: false), path: path) } it "raises a ConstraintNotSatisfied error" do lambda { subject.download(double('path')) }.should raise_error(ConstraintNotSatisfied) end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems