Sha256: 434980941b969f22ec3bc94278ac5f18bc6db3f566231e2f0c64ed348c205178

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 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"])
      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"])
      expect do
        subject.validate_files(cookbook)
      end.to_not raise_error
    end

    it "does not raise an exception with spaces in the path" do
      allow(Dir).to receive(:glob).and_return(["/there are/spaces/in this/recipes/default.rb"])
      allow_any_instance_of(Pathname).to receive(:dirname).and_return("/there are/spaces/in this")

      expect do
        subject.validate_files(cookbook)
      end.to_not raise_error
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
berkshelf-6.2.2 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.2.1 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.2.0 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.1.1 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.1.0 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.0.1 spec/unit/berkshelf/validator_spec.rb
berkshelf-6.0.0 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.5 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.4 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.3 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.2 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.1 spec/unit/berkshelf/validator_spec.rb
berkshelf-5.6.0 spec/unit/berkshelf/validator_spec.rb