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.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.5.travis.3089.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.5.travis.3069.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.5.travis.3062.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3055.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3054.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3053.5 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3047.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3040.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3032.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3031.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3030.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.3.travis.3021.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.3 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.4.travis.3022.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.3.travis.3020.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.3.travis.3017.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.3.travis.3014.6 spec/provider/packagecloud_spec.rb
dpl-packagecloud-1.10.2 spec/provider/packagecloud_spec.rb