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.10.17.travis.6637.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.16 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.16.travis.6625.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.16.travis.6619.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.16.travis.5961.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.15 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.15.travis.5877.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.14 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.13 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.13.travis.4159.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.13.travis.4141.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.13.travis.4040.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.13.travis.4033.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.12 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.12.travis.3794.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.12.travis.3506.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.11.travis.3504.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.11 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.11.travis.3499.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.11.travis.3497.5 spec/provider/packagecloud_spec.rb