|
128 | 128 | it do
|
129 | 129 | should include_class('pureftpd')
|
130 | 130 | should include_class('pureftpd::install')
|
131 |
| - should include_class('pureftpd::config') |
132 |
| - should include_class('pureftpd::config::ldap') |
| 131 | + should contain_class('pureftpd::config') \ |
| 132 | + .with_notify('Class[Pureftpd::Service]') |
| 133 | + should contain_class('pureftpd::config::ldap') \ |
| 134 | + .with_notify('Class[Pureftpd::Service]') |
133 | 135 | should include_class('pureftpd::service')
|
134 | 136 | should contain_package('pure-ftpd').with_ensure('present')
|
135 | 137 | should_not contain_package('pure-ftpd-selinux')
|
|
159 | 161 | it do
|
160 | 162 | should include_class('pureftpd')
|
161 | 163 | should include_class('pureftpd::install')
|
162 |
| - should include_class('pureftpd::config') |
163 |
| - should include_class('pureftpd::config::pgsql') |
| 164 | + should contain_class('pureftpd::config') \ |
| 165 | + .with_notify('Class[Pureftpd::Service]') |
| 166 | + should contain_class('pureftpd::config::pgsql') \ |
| 167 | + .with_notify('Class[Pureftpd::Service]') |
164 | 168 | should include_class('pureftpd::service')
|
165 | 169 | should contain_package('pure-ftpd').with_ensure('present')
|
166 | 170 | should_not contain_package('pure-ftpd-selinux')
|
|
180 | 184 | end
|
181 | 185 | end
|
182 | 186 |
|
| 187 | + describe 'with all config sections' do |
| 188 | + let(:params) {{ |
| 189 | + :use_selinux => true, |
| 190 | + :config => { |
| 191 | + 'ipv4only' => 'Yes', |
| 192 | + }, |
| 193 | + :config_ldap => { |
| 194 | + 'ldapserver' => 'ldap.example.com', |
| 195 | + }, |
| 196 | + :config_pgsql => { |
| 197 | + 'pgsqlserver' => 'localhost', |
| 198 | + } |
| 199 | + }} |
| 200 | + it do |
| 201 | + should include_class('pureftpd') |
| 202 | + should include_class('pureftpd::install') |
| 203 | + should contain_class('pureftpd::config') \ |
| 204 | + .with_notify('Class[Pureftpd::Service]') |
| 205 | + should contain_class('pureftpd::config::ldap') \ |
| 206 | + .with_notify('Class[Pureftpd::Service]') |
| 207 | + should contain_class('pureftpd::config::pgsql') \ |
| 208 | + .with_notify('Class[Pureftpd::Service]') |
| 209 | + should include_class('pureftpd::service') |
| 210 | + should contain_package('pure-ftpd').with_ensure('present') |
| 211 | + should contain_package('pure-ftpd-selinux').with_ensure('present') |
| 212 | + should contain_file('/etc/pure-ftpd/pure-ftpd.conf').with_ensure('file') \ |
| 213 | + .with_content(%r{PGSQLConfigFile /etc/pure-ftpd/pureftpd-pgsql.conf})\ |
| 214 | + .with_content(%r{LDAPConfigFile /etc/pure-ftpd/pureftpd-ldap.conf}) |
| 215 | + should contain_file('/etc/pure-ftpd/pureftpd-ldap.conf').with_ensure('file') \ |
| 216 | + .with_content(<<-END.gsub(/^\s+/, "")) |
| 217 | + LDAPServer ldap.example.com |
| 218 | + END |
| 219 | + should contain_file('/etc/pure-ftpd/pureftpd-pgsql.conf').with_ensure('file') \ |
| 220 | + .with_content(<<-END.gsub(/^\s+/, "")) |
| 221 | + PGSQLServer localhost |
| 222 | + END |
| 223 | + should contain_service('pure-ftpd').with({ |
| 224 | + 'ensure' => 'running', |
| 225 | + 'enable' => 'true', |
| 226 | + }) |
| 227 | + end |
| 228 | + end |
| 229 | + |
183 | 230 | end
|
0 commit comments