Sha256: f293ceb9099821abec8065083212aec591f9776ec849143c1044999cb8b94e82

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Berkshelf::Downloader do
  let(:berksfile) { double('berksfile') }
  subject { described_class.new(berksfile) }

  describe "#download" do
    pending
  end

  describe "#try_download" do
    let(:remote_cookbook) { double('remote-cookbook') }
    let(:source) do
      source = double('source')
      allow(source).to receive(:cookbook) { remote_cookbook }
      source
    end
    let(:name) { "fake" }
    let(:version) { "1.0.0" }

    it "supports the 'opscode' location type" do
      allow(remote_cookbook).to receive(:location_type) { :opscode }
      allow(remote_cookbook).to receive(:location_path) { "http://api.opscode.com" }
      rest = double('community-rest')
      expect(Berkshelf::CommunityREST).to receive(:new).with("http://api.opscode.com") { rest }
      expect(rest).to receive(:download).with(name, version)
      subject.try_download(source, name, version)
    end

    it "supports the 'supermarket' location type" do
      allow(remote_cookbook).to receive(:location_type) { :supermarket }
      allow(remote_cookbook).to receive(:location_path) { "http://api.supermarket.com" }
      rest = double('community-rest')
      expect(Berkshelf::CommunityREST).to receive(:new).with("http://api.supermarket.com") { rest }
      expect(rest).to receive(:download).with(name, version)
      subject.try_download(source, name, version)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
berkshelf-3.1.5 spec/unit/berkshelf/downloader_spec.rb