Skip to content

Commit

Permalink
add missing configuration options/params to pureftpd::config + rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Aug 5, 2013
1 parent d7ebceb commit d50e2af
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
7 changes: 7 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
$anonymousratio = undef,
$userratio = undef,
$umask = undef,
$quota = undef,
$peruserlimits = undef,
$ldapconfigfile = undef,
$mysqlconfigfile = undef,
$pgsqlconfigfile = undef,
$puredb = undef,
$extauth = undef,
) inherits pureftpd::params {

$conf_options = [
Expand Down
102 changes: 102 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
require 'spec_helper'

config_options = [
'IPV4Only',
'IPV6Only',
'ChrootEveryone',
'BrokenClientsCompatibility',
'Daemonize',
'VerboseLog',
'DisplayDotFiles',
'AnonymousOnly',
'NoAnonymous',
'DontResolve',
'AnonymousCanCreateDirs',
'NATmode',
'CallUploadScript',
'AntiWarez',
'AllowUserFXP',
'AllowAnonymousFXP',
'ProhibitDotFilesWrite',
'ProhibitDotFilesRead',
'AllowDotFiles',
'AutoRename',
'AnonymousCantUpload',
'LogPID',
'NoChmod',
'KeepAllFiles',
'CreateHomeDir',
'NoRename',
'CustomerProof',
'NoTruncate',
'FileSystemCharset',
'ClientCharset',
'SyslogFacility',
'FortunesFile',
'ForcePassiveIP',
'Bind',
'AnonymousBandwidth',
'UserBandwidth',
'TrustedIP',
'AltLog',
'PIDFile',
'MaxIdleTime',
'MaxDiskUsage',
'TrustedGID',
'MaxClientsNumber',
'MaxClientsPerIP',
'MaxLoad',
'MinUID',
'TLS',
'LimitRecursion',
'PassivePortRange',
'AnonymousRatio',
'UserRatio',
'Umask',
'Quota',
'PerUserLimits',
'LDAPConfigFile',
'MySQLConfigFile',
'PGSQLConfigFile',
'PureDB',
'ExtAuth',
]

describe 'pureftpd::config' do

shared_examples 'config' do |params, content|
let(:facts) {{ :osfamily=> 'RedHat' }}
let(:params) { params }

it do
should include_class('pureftpd::config')
should contain_file('/etc/pure-ftpd/pure-ftpd.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
config_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

# test all of the known options at once this works because the ordering of
# options values in the output file is fixed
context 'all parameters' do
it_behaves_like 'config', all_params, all_content
end

end

0 comments on commit d50e2af

Please sign in to comment.