Sha256: 3f073a56ab463fa13baff39af938b05c73dc833be50e821e60ec87a36d386f84

Contents?: true

Size: 994 Bytes

Versions: 7

Compression:

Stored size: 994 Bytes

Contents

require 'spec_helper'
describe 'apt::force', :type => :define do
  let :title do
    'my_package'
  end

  let :default_params do
    {
      :release => 'testing',
      :version => false
    }
  end

  [{},
   {
      :release  => 'stable',
      :version  => '1'
    }
  ].each do |param_set|
    describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
      let :param_hash do
        default_params.merge(param_set)
      end

      let :params do
        param_set
      end

      let :unless_query do
        base_command = "/usr/bin/dpkg -s #{title} | grep -q "
        base_command + (params[:version] ? "'Version: #{params[:version]}'" : "'Status: install'")
      end

      let :exec_title do
        base_exec = "/usr/bin/aptitude -y -t #{param_hash[:release]} install #{title}"
        base_exec + (params[:version] ? "=#{params[:version]}" : "")
      end
      it { should contain_exec(exec_title).with_unless(unless_query) }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
service_kiosk-0.5.6 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.5 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.4 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.3 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.2 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.1 provision/modules/apt/spec/defines/force_spec.rb
service_kiosk-0.5.0 provision/modules/apt/spec/defines/force_spec.rb