Sha256: 9c0922733e0fd2625361fdbf32b983d2bdb9306152aacd0fc036b825c7087189

Contents?: true

Size: 1.09 KB

Versions: 21

Compression:

Stored size: 1.09 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe Puppet::Type.type(:package).provider(:aptitude) do
  let :type do Puppet::Type.type(:package) end
  let :pkg do
    type.new(:name => 'faff', :provider => :aptitude, :source => '/tmp/faff.deb')
  end

  it { should be_versionable }

  context "when retrieving ensure" do
    { :absent   => "deinstall ok config-files faff 1.2.3-1\n",
      "1.2.3-1" => "install ok installed faff 1.2.3-1\n",
    }.each do |expect, output|
      it "should detect #{expect} packages" do
        pkg.provider.expects(:dpkgquery).
          with('-W', '--showformat', '${Status} ${Package} ${Version}\n', 'faff').
          returns(output)

        pkg.property(:ensure).retrieve.should == expect
      end
    end
  end

  it "should try and install when asked" do
    pkg.provider.expects(:aptitude).
      with('-y', '-o', 'DPkg::Options::=--force-confold', :install, 'faff').
      returns(0)

    pkg.provider.install
  end

  it "should try and purge when asked" do
    pkg.provider.expects(:aptitude).with('-y', 'purge', 'faff').returns(0)
    pkg.provider.purge
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
puppet-3.2.4 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.3 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.3.rc1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.2 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.1.rc1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.0.rc2 spec/unit/provider/package/aptitude_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/package/aptitude_spec.rb
puppet-3.2.0.rc1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.1.1 spec/unit/provider/package/aptitude_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/package/aptitude_spec.rb
puppet-3.1.0 spec/unit/provider/package/aptitude_spec.rb
puppet-3.1.0.rc2 spec/unit/provider/package/aptitude_spec.rb
puppet-3.1.0.rc1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.2 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.2.rc3 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.2.rc2 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.2.rc1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.1 spec/unit/provider/package/aptitude_spec.rb
puppet-3.0.1.rc1 spec/unit/provider/package/aptitude_spec.rb