--- /dev/null
+require 'rake'
+
+task :default => [:spec]
+
+desc "Run all module spec tests (Requires rspec-puppet gem)"
+task :spec do
+ system("rspec spec/**/*_spec.rb")
+end
+
+desc "Build package"
+task :build do
+ system("puppet-module build")
+end
+
--- /dev/null
+require 'spec_helper'
+describe 'apt::ppa', :type => :define do
+ ['ppa:dans_ppa', 'dans_ppa'].each do |t|
+ describe "with title #{t}" do
+ let :pre_condition do
+ 'class { "apt": }'
+ end
+ let :title do
+ t
+ end
+ let :unless_statement do
+ if t =~ /ppa:(.*)/
+ /^[^#].*ppa.*#{$1}.*$/
+ else
+ /^[^#].*#{t}.*$/
+ end
+ end
+ it { should contain_exec("add-apt-repository-#{t}").with(
+ 'command' => "/usr/bin/add-apt-repository #{t}",
+ 'notify' => "Exec[apt-update-#{t}]"
+ )
+ }
+ it { should contain_exec("add-apt-repository-#{t}").with_unless(unless_statement) }
+ it { should contain_exec("apt-update-#{t}").with(
+ 'command' => '/usr/bin/aptitude update',
+ 'refreshonly' => true
+ )
+ }
+ it { should contain_exec("apt-update-#{t}").without_unless }
+ end
+ end
+end
--- /dev/null
+require 'puppet'
+require 'rubygems'
+require 'rspec-puppet'
+
+def param_value(subject, type, title, param)
+ subject.resource(type, title).send(:parameters)[param.to_sym]
+end
+
+RSpec.configure do |c|
+ c.module_path = File.join(File.dirname(__FILE__), '../../')
+end