Sha256: 0612ea11e7edab34e128fa32803a0b7541347a34ecd65540e618603f24549325

Contents?: true

Size: 1.99 KB

Versions: 34

Compression:

Stored size: 1.99 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Sprinkle::Installers::Apt do

  before do
    @package = mock(Sprinkle::Package, :name => 'package')
  end

  def create_apt(*debs, &block)
    Sprinkle::Installers::Apt.new(@package, *debs, &block)
  end

  describe 'when created' do

    it 'should accept a single package to install' do
      @installer = create_apt 'ruby'
      @installer.packages.should == [ 'ruby' ]
    end

    it 'should accept an array of packages to install' do
      @installer = create_apt %w( gcc gdb g++ )
      @installer.packages.should == ['gcc', 'gdb', 'g++']
    end

    it 'should remove options from packages list' do
      @installer = create_apt 'ruby', :dependencies_only => true
      @installer.packages.should == [ 'ruby' ]
    end

  end

  describe 'during installation' do

    before do
      @installer = create_apt 'ruby' do
        pre :install, 'op1'
        post :install, 'op2'
      end
      @install_commands = @installer.send :install_commands
    end

    it 'should invoke the apt installer for all specified packages' do
      @install_commands.should =~ /apt-get -qyu install ruby/
    end

    it 'should specify a non interactive mode to the apt installer' do
      @install_commands.should =~ /DEBIAN_FRONTEND=noninteractive/
    end

    it 'should automatically insert pre/post commands for the specified package' do
      @installer.send(:install_sequence).should == [ 'op1', %(DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get -qyu install ruby), 'op2' ]
    end

    it 'should install a specific version if defined'

  end
  
  describe 'during dependencies only installation' do

    before do
      @installer = create_apt('ruby') { dependencies_only true }
      @install_commands = @installer.send :install_commands
    end

    it 'should invoke the apt installer with build-dep command for all specified packages' do
      @install_commands.should =~ /apt-get -qyu build-dep ruby/
    end
    
  end
end

Version data entries

34 entries across 34 versions & 8 rubygems

Version Path
crafterm-sprinkle-0.1.6 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.1.7 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.1.8 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.1.9 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.2.0 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.2.1 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.2.2 spec/sprinkle/installers/apt_spec.rb
crafterm-sprinkle-0.2.3 spec/sprinkle/installers/apt_spec.rb
jemmyw-sprinkle-0.2.3 spec/sprinkle/installers/apt_spec.rb
jemmyw-sprinkle-0.2.4 spec/sprinkle/installers/apt_spec.rb
jsierles-sprinkle-0.1.9 spec/sprinkle/installers/apt_spec.rb
justsee-sprinkle-0.2.4 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.1 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.10 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.11 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.13 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.14 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.2 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.3 spec/sprinkle/installers/apt_spec.rb
lachlan-sprinkle-0.0.4 spec/sprinkle/installers/apt_spec.rb