Merge pull request #531 from justinstoller/maint/master/set-puppet-version
[puppet-modules/puppetlabs-apt.git] / spec / spec_helper_acceptance.rb
1 require 'beaker-rspec'
2
3 # Install Puppet
4 unless ENV['RS_PROVISION'] == 'no'
5   # This will install the latest available package on el and deb based
6   # systems fail on windows and osx, and install via gem on other *nixes
7   foss_opts = {
8     :default_action => 'gem_install',
9     :version        => (ENV['PUPPET_VERSION'] || '3.8.1'),
10   }
11
12   if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
13
14   hosts.each do |host|
15     on host, "mkdir -p #{host['distmoduledir']}"
16   end
17 end
18
19 UNSUPPORTED_PLATFORMS = ['RedHat','Suse','windows','AIX','Solaris']
20
21 RSpec.configure do |c|
22   # Project root
23   proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
24
25   # Readable test descriptions
26   c.formatter = :documentation
27
28   # Configure all nodes in nodeset
29   c.before :suite do
30     # Install module and dependencies
31     hosts.each do |host|
32       copy_module_to(host, :source => proj_root, :module_name => 'apt')
33       shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
34       on host, puppet('module install puppetlabs-stdlib --version 4.5.0'), { :acceptable_exit_codes => [0,1] }
35     end
36   end
37 end