2 describe 'apt::ppa', :type => :define do
3 ['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t|
4 describe "with title #{t}" do
9 {:lsbdistcodename => 'natty'}
18 t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list"
21 it { should contain_package("python-software-properties") }
23 it { should contain_exec("apt_update").with(
24 'command' => '/usr/bin/apt-get update',
29 it { should contain_exec("add-apt-repository-#{t}").with(
30 'command' => "/usr/bin/add-apt-repository #{t}",
31 'creates' => "/etc/apt/sources.list.d/#{filename}",
32 'require' => "Package[python-software-properties]",
33 'notify' => "Exec[apt_update]"
37 it { should create_file("/etc/apt/sources.list.d/#{filename}").with(
39 'require' => "Exec[add-apt-repository-#{t}]"
45 describe "it should not error if package['python-software-properties'] is already defined" do
48 'package { "python-software-properties": }->Apt::Ppa["ppa"]'
51 {:lsbdistcodename => 'natty'}
54 let(:release) { "natty" }
55 it { should contain_package("python-software-properties") }
58 describe "without Class[apt] should raise a Puppet::Error" do
59 let(:release) { "natty" }
61 it { expect { should contain_apt__ppa(title) }.to raise_error(Puppet::Error) }
64 describe "without release should raise a Puppet::Error" do
65 let(:title) { "ppa:" }
66 it { expect { should contain_apt__ppa(:release) }.to raise_error(Puppet::Error) }