Can't figure out how to write a puppet-Rspec test for the class, that takes parameters and calls 'create_resources' for defined type, passing resources to that function.
**Update**: Looks like that I need to test only a httpd::vhost_template, but don't know how.
Here is the class I stuck with:
class httpd::vhosts($vhosts_config) {
if $vhosts_config[use_templates] {
notice 'use templates!'
create_resources(httpd::vhost_template, $vhosts_config[vhosts])
}
}
Here is the **httpd::vhost_template** resource definition
define httpd::vhost_template ($vhost_name, $vhost_url, $vhost_order) {
$basepath = '/vagrant/httpd2_test'
validate_string($vhost_name)
validate_string($vhost_url)
validate_string($vhost_order)
$file_name = "${vhost_order}_${vhost_name}.conf"
file { "${basepath}/conf.d/${file_name}":
ensure => file,
content => template('httpd/0x_www.template.xx.conf.erb'),
}
}
Any hints?
↧