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.9.7.travis.2851.6 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2848.6 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2837.6 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2827.6 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2795.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2794.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2790.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2786.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.6.travis.2785.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.5.travis.2783.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.5.travis.2781.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.5.travis.2782.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.5.travis.2775.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.4.travis.2773.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.4 spec/provider/hackage_spec.rb
dpl-hackage-1.9.4.travis.2768.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.4.travis.2766.5 spec/provider/hackage_spec.rb
dpl-hackage-1.9.3 spec/provider/hackage_spec.rb