Sha256: ea9df15f8c5979c8a39b8e472ec82c54d1e8b774105e3fbe83fc87f226f208d6

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

# encoding: utf-8
describe 'Packaging' do

   it 'should install neccesarry packages' do
     allow(File).to receive(:exist?).and_return(true)
     allow(File).to receive(:open).and_return(true)
     [
       "dpkg-query -l apt 2>&1 |awk 'END { if($1==\"ii\") exit 0; else exit 1; }'",
       "dpkg-query -l cow 2>&1 |awk 'END { if($1==\"ii\") exit 0; else exit 1; }'"
     ].each do |command|
       allow(Debsacker::SystemGateway).to receive(:perform_with_exit_code).with(command).and_return(false)
     end
     [
       "apt-get install -y -q apt",
       "apt-get install -y -q cow"
     ].each do |command|
       expect(Debsacker::SystemGateway).to receive(:perform_with_exit_code).with(command).and_return(true)
     end

     expect(Debsacker::SystemGateway).to receive(:perform_with_exit_code).with('dpkg-buildpackage -uc -us -b').and_return(true)

     Debsacker::Creator.go(double(generate: '0.1.0'), Debsacker::Package::Control.new('spec/fixtures/control'))
  end

  it 'should build package' do
    allow(File).to receive(:exist?).and_return(true)
    allow(File).to receive(:open).and_return(true)
    allow(Debsacker::SystemGateway).to receive(:perform).and_return(true)
    allow(Debsacker::SystemGateway).to receive(:perform_with_exit_code).and_return(true)

    [
      "dpkg-query -l apt 2>&1 |awk 'END { if($1==\"ii\") exit 0; else exit 1; }'",
      "dpkg-query -l cow 2>&1 |awk 'END { if($1==\"ii\") exit 0; else exit 1; }'"
    ].each do |command|
      expect(Debsacker::SystemGateway).to receive(:perform_with_exit_code).with(command)
    end
    %w(changelog compat control).each do |file|
        expect(File).to receive(:exist?).with("debian/#{file}")
    end

    Debsacker::Creator.go(double(generate: '0.1.0'), Debsacker::Package::Control.new('spec/fixtures/control'))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
debsacker-0.1.5 spec/debsacker/packaging_spec.rb
debsacker-0.1.3 spec/debsacker/packaging_spec.rb