/
Dockerfile_spec.rb
89 lines (75 loc) · 2.31 KB
/
Dockerfile_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# spec/Dockerfile_spec.rb
require "serverspec"
require "docker"
# Workaround needed for circleCI
if ENV['CIRCLECI']
class Docker::Container
def remove(options={}); end
alias_method :delete, :remove
end
end
describe "Dockerfile" do
before(:all) do
image = Docker::Image.build_from_dir('.')
set :os, :family => 'redhat'
set :backend, :docker
set :docker_image, image.id
end
it "installs required packages" do
expect(package("httpd")).to be_installed
expect(package("npm")).to be_installed
end
describe 'Apache Install' do
describe command('apachectl -M') do
its(:stdout) { should include('rewrite_module') }
its(:stdout) { should include('php5_module') }
end
describe command('apachectl -V') do
# test 'Prefork' exists between "Server MPM" and "Server compiled".
its(:stdout) { should include('Prefork') }
# test 'conf/httpd.conf' exists after "SERVER_CONFIG_FILE".
its(:stdout) { should include('conf/httpd.conf') }
# test 'Apache/2.2.15' exists before "Server built".
its(:stdout) { should include(' Apache/2.2.15') }
end
end
describe 'PHP config parameters' do
context php_config('default_mimetype') do
its(:value) { should eq 'text/html' }
end
context php_config('xdebug.max_nesting_level') do
its(:value) { should eq 300 }
end
context php_config('xdebug.remote_port') do
its(:value) { should eq 9000 }
end
context php_config('xdebug.profiler_enable') do
its(:value) { should eq 0 }
end
end
describe 'NodeJS Packages - version specifc' do
describe package('less') do
it { should be_installed.by('npm').with_version('1.7.5') }
end
describe package('uglify-js') do
it { should be_installed.by('npm').with_version('2.3.6') }
end
describe package('uglifycss') do
it { should be_installed.by('npm').with_version('0.0.10') }
end
describe package('grunt') do
it { should be_installed.by('npm') }
end
end
describe 'Misc installed executables' do
describe file("/usr/bin/drush") do
it { should be_executable }
end
describe file("/usr/bin/composer.phar") do
it { should be_executable }
end
describe file("/usr/bin/unzip") do
it { should be_executable }
end
end
end