Sha256: f18c1dddf1ff099d2bb7f367b4e2148c9048e7e550ff18fb5553e9ecb8c454f6

Contents?: true

Size: 1.79 KB

Versions: 270

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'
require 'rubygems'
require 'gems'
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

270 entries across 270 versions & 2 rubygems

Version Path
dpl-1.8.48.travis.2486.5 spec/provider/packagecloud_spec.rb
dpl-1.8.47 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2485.5 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2484.5 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2483.5 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2459.3 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2458.3 spec/provider/packagecloud_spec.rb
dpl-1.8.46 spec/provider/packagecloud_spec.rb
dpl-1.8.47.travis.2456.5 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2455.5 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2454.5 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2451.5 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2449.5 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2444.5 spec/provider/packagecloud_spec.rb
dpl-1.8.45 spec/provider/packagecloud_spec.rb
dpl-1.8.46.travis.2418.5 spec/provider/packagecloud_spec.rb
dpl-1.8.45.travis.2417.5 spec/provider/packagecloud_spec.rb
dpl-1.8.44 spec/provider/packagecloud_spec.rb
dpl-1.8.45.travis.2398.5 spec/provider/packagecloud_spec.rb
dpl-1.8.44.travis.2397.5 spec/provider/packagecloud_spec.rb