Skip to content
Prev Previous commit
Next Next commit
Add test to prevent breaking the main conf
  • Loading branch information
javierbertoli committed Oct 22, 2013
commit 5a34ea2f4ddb32ca251eea57af1817c69dc62c9d
46 changes: 46 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,52 @@
end

describe 'Test customizations - template' do
let(:facts) { { :operatingsystem => 'Debian', :processorcount => 8 } }
let(:params) do
{
:template => "nginx/conf.d/nginx.conf.erb"
}
end
let(:expected) do
'# File Managed by Puppet
user www-data;
worker_processes 8;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
#
}

http {
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;
tcp_nodelay on;
client_max_body_size 10m;
keepalive_timeout 65;
types_hash_max_size 1024;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

include /etc/nginx/sites-available/*.conf;
}
'
end
it 'should generate a valid template' do
should contain_file('nginx.conf').with_content(expected)
end
end

describe 'Test customizations - use own template' do
let(:params) { {:template => "nginx/spec.erb" , :options => { 'opt_a' => 'value_a' } } }

it 'should generate a valid template' do
Expand Down