forked from jhoblitt/puppet-pureftpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update pureftpd::config::pgsql to use the common erb template + rspec
- Loading branch information
Joshua Hoblitt
committed
Aug 6, 2013
1 parent
f50f4db
commit ab4cfb9
Showing
4 changed files
with
105 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'spec_helper' | ||
|
||
test_options = [ | ||
'PGSQLServer', | ||
'PGSQLPort', | ||
'PGSQLUser', | ||
'PGSQLPassword', | ||
'PGSQLDatabase', | ||
'PGSQLCrypt', | ||
'PGSQLGetPW', | ||
'PGSQLGetUID', | ||
'PGSQLDefaultUID', | ||
'PGSQLGetGID', | ||
'PGSQLDefaultGID', | ||
'PGSQLGetDir', | ||
'PGSQLGetQTAFS', | ||
'PGSQLGetQTASZ', | ||
'PGSQLGetRatioUL', | ||
'PGSQLGetRatioDL', | ||
'PGSQLGetBandwidthUL', | ||
'PGSQLGetBandwidthDL', | ||
] | ||
|
||
describe 'pureftpd::config::pgsql' do | ||
|
||
shared_examples 'config' do |params, content| | ||
let(:facts) {{ :osfamily=> 'RedHat' }} | ||
let(:params) { params } | ||
|
||
it do | ||
should include_class('pureftpd::config::pgsql') | ||
should contain_file('/etc/pure-ftpd/pureftpd-pgsql.conf') \ | ||
.with_ensure('file') \ | ||
.with_content(content) | ||
end | ||
end | ||
|
||
all_params = {} | ||
all_content = '' | ||
value = 'xxx' | ||
|
||
# accumutate all of the params and content strings as we test each individual | ||
# option so we can use them for the next test | ||
context 'one option at a time' do | ||
test_options.each do |option| | ||
params = {} | ||
params[option.downcase.to_sym] = value | ||
content = sprintf("%-19s %s\n", option, value) | ||
|
||
all_params.merge!(params) | ||
all_content += content | ||
|
||
it_behaves_like 'config', params, content | ||
end | ||
end | ||
|
||
# test all of the known options at once this works because the ordering of | ||
# options values in the output file is fixed | ||
context 'all options' do | ||
it_behaves_like 'config', all_params, all_content | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.