Sha256: e1c6e6a2b2a45188829829c770e306a051a60c501b4edace33a869dd54a2c893

Contents?: true

Size: 1.78 KB

Versions: 133

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'
require 'rubygems'
require 'dpl/provider/packagecloud'

describe DPL::Provider::Packagecloud do

  subject :provider do
    described_class.new(DummyContext.new, :username => 'joedamato', :repository => 'test_repo', :token => 'test_token')
  end

  describe "#setup_auth" do
    it 'should get username and token' do
      expect(provider).to receive(:log).with("Logging into https://packagecloud.io with joedamato:****************oken")
      provider.setup_auth
    end

    it 'should require username' do
      new_provider = described_class.new(DummyContext.new, {:token => 'test_token'})
      expect{ new_provider.setup_auth }.to raise_error("missing username")
    end

    it 'should require token' do
      new_provider = described_class.new(DummyContext.new, {:username => 'test_token'})
      expect{ new_provider.setup_auth }.to raise_error("missing token")
    end

    it 'should require repository' do
      new_provider = described_class.new(DummyContext.new, {:username => 'joedamato', :token => 'test_token'})
      expect{ new_provider.setup_auth }.to raise_error("missing repository")
    end

  end

  describe "#push_app" do
    it 'defaults to searching everywhere' do
      expect(Dir).to receive(:glob).with('**/*')
      expect { provider.push_app }.to raise_error(DPL::Error)
    end

    it 'accepts and uses a string glob' do
      provider.options.update(:package_glob => 'foo*.gem')

      expect(Dir).to receive(:glob).with('foo*.gem')
      expect { provider.push_app }.to raise_error(DPL::Error)
    end

    it 'accepts and uses an array of globs' do
      provider.options.update(:package_glob => ['*.rpm', '**/*.deb'])

      expect(Dir).to receive(:glob).with('*.rpm', '**/*.deb')
      expect { provider.push_app }.to raise_error(DPL::Error)
    end
  end

end

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
dpl-packagecloud-1.9.2 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2763.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2762.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2750.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2749.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2748.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2737.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2725.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.2.travis.2724.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2711.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2710.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2705.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.0 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2689.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2669.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2666.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2660.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2639.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.9.1.travis.2637.5 spec/provider/packagecloud_spec.rb