-
Notifications
You must be signed in to change notification settings - Fork 13
/
default_spec.rb
49 lines (39 loc) · 1.35 KB
/
default_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'chefspec'
require 'chefspec/berkshelf'
#require 'chefspec/server'
require 'spec_helper.rb'
shared_examples 'general tests' do |platform, version|
context "on #{platform} #{version}" do
let(:chef_run) do
ChefSpec::Runner.new(platform: platform, version: version) do |node|
#node.set['foo']['users'] = users
end
end
it 'runs without errors. see test-kitchen tests for more comprehensive tests not possible here' do
chef_run.converge(described_recipe)
expect(chef_run).to include_recipe 'python::default'
end
it 'generates the installer template correctly' do
chef_run.converge(described_recipe)
# must be exactly 4 lines
installer_config_path = "#{Chef::Config[:file_cache_path]}/installer_config"
expect(chef_run).to render_file(installer_config_path).with_content(/.*\n.*\n.*\n.*/)
end
end
end
#describe 'foo::default' do
describe 'chef-continuum-anaconda::default' do
platforms = {
'ubuntu' => [ '12.04', '13.04', '13.10' ],
#'ubuntu' => [ '12.04' ],
#'debian' => ['6.0.5'],
#'centos' => ['5.8', '6.0', '6.3'],
#'redhat' => ['5.8', '6.3'],
}
platforms.each do |platform, versions|
versions.each do |version|
Fauxhai.mock(platform: platform, version: version)
include_examples 'general tests', platform, version
end
end
end