Sha256: 235b2fd2e3cf213f2c69e5e7cb4a8cfaafdfcbfe5b988b200c285952b25272a8

Contents?: true

Size: 1.32 KB

Versions: 588

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'
require 'dpl/provider/hackage'

describe DPL::Provider::Hackage do
  subject :provider do
    described_class.new(DummyContext.new, :username => 'FooUser', :password => 'bar')
  end

  describe "#check_auth" do
    it 'should require username' do
      provider.options.update(:username => nil)
      expect {
        provider.check_auth
      }.to raise_error(DPL::Error)
    end

    it 'should require password' do
      provider.options.update(:password => nil)
      expect {
        provider.check_auth
      }.to raise_error(DPL::Error)
    end
  end

  describe "#check_app" do
    it 'calls cabal' do
      expect(provider.context).to receive(:shell).with("cabal check").and_return(true)
      provider.check_app
    end

    it 'fails when cabal complains' do
      expect(provider.context).to receive(:shell).with("cabal check").and_return(false)
      expect {
        provider.check_app
      }.to raise_error(DPL::Error)
    end
  end

  describe "#push_app" do
    example do
      expect(provider.context).to receive(:shell).with("cabal sdist").and_return(true)
      expect(Dir).to receive(:glob).and_yield('dist/package-0.1.2.3.tar.gz')
      expect(provider.context).to receive(:shell).with("cabal upload --username=FooUser --password=bar dist/package-0.1.2.3.tar.gz")
      provider.push_app
    end
  end
end

Version data entries

588 entries across 588 versions & 3 rubygems

Version Path
dpl-hackage-1.10.17.travis.6637.6 spec/provider/hackage_spec.rb
dpl-hackage-1.10.16 spec/provider/hackage_spec.rb
dpl-hackage-1.10.16.travis.6625.6 spec/provider/hackage_spec.rb
dpl-hackage-1.10.16.travis.6619.6 spec/provider/hackage_spec.rb
dpl-hackage-1.10.16.travis.5961.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.15 spec/provider/hackage_spec.rb
dpl-hackage-1.10.15.travis.5877.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.14 spec/provider/hackage_spec.rb
dpl-hackage-1.10.13 spec/provider/hackage_spec.rb
dpl-hackage-1.10.13.travis.4159.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.13.travis.4141.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.13.travis.4040.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.13.travis.4033.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.12 spec/provider/hackage_spec.rb
dpl-hackage-1.10.12.travis.4032.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.12.travis.3794.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.12.travis.3506.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.11.travis.3504.5 spec/provider/hackage_spec.rb
dpl-hackage-1.10.11 spec/provider/hackage_spec.rb
dpl-hackage-1.10.11.travis.3499.5 spec/provider/hackage_spec.rb