Rewrite jail.local handling through source/content.

Add tests
This commit is contained in:
Javier Bértoli
2013-04-29 13:41:22 -03:00
parent 9a1a8a188a
commit d213d8408c
8 changed files with 86 additions and 68 deletions
+25
View File
@@ -13,6 +13,31 @@ describe 'fail2ban' do
it { should contain_file('fail2ban.conf').with_ensure('present') }
end
describe 'Test jails config undefined' do
let(:params) { {:jails_config => '' } }
it { should_not contain_file('jail.local') }
end
describe 'Test jails managed throuh file - source' do
let(:params) { {:jails_config => 'file', :jails_source => 'puppet:///modules/fail2ban/spec' } }
it { should contain_file('jail.local').with_source('puppet:///modules/fail2ban/spec') }
it { should contain_file('jail.local').without_content }
end
describe 'Test jails managed throuh file - template' do
let(:params) { {:jails_config => 'file', :jails_template => 'fail2ban/spec.erb', :options => { 'opt_a' => 'value_a' } } }
it { should contain_file('jail.local').with_content(/fqdn: rspec.example42.com/) }
it { should contain_file('jail.local').without_source }
it { should contain_file('jail.local').with_content(/value_a/) }
end
# describe 'Test jails managed throuh concat' do
# let(:params) { {:jails_config => 'concat' } }
# it { should include_class('fail2ban::jailsconcat') }
# it { should contain_fail2ban__jailsconcat() }
#
# end
describe 'Test installation of a specific version' do
let(:params) { {:version => '1.0.42' } }
it { should contain_package('fail2ban').with_ensure('1.0.42') }