Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
Last active December 20, 2015 13:59
Show Gist options
  • Save jhoblitt/6143313 to your computer and use it in GitHub Desktop.
Save jhoblitt/6143313 to your computer and use it in GitHub Desktop.
rspec subclass Puppe::Error
class pureftpd::config_ldap (
$ldapport = undef,
$ldapbinddn = undef,
$ldapbindpw = undef,
$ldapbasedn = undef,
$ldapfilter = undef,
$ldaphomedir = undef,
$ldapversion = undef,
$ldapdefaultuid = undef,
$ldapforcedefaultuid = undef,
$ldapdefaultgid = undef,
$ldapforcedefaultgid = undef,
$ldapusetls = undef,
$ldapauthmethod = undef,
)
inherits pureftpd::params
{
# the complete list of options is defined in pure-ftpd/src/log_ldap_p.h
$ldap_conf_options = [
'LDAPPort',
'LDAPBindDN',
'LDAPBindPW',
'LDAPBaseDN',
'LDAPFilter',
'LDAPHomeDir',
'LDAPVersion',
'LDAPDefaultUID',
'LDAPForceDefaultUID',
'LDAPDefaultGID',
'LDAPForceDefaultGID',
'LDAPUseTLS',
'LDAPAuthMethod',
]
file { $pureftpd::params::ldap_conf_path:
ensure => file,
content => template("${module_name}/${pureftpd::params::ldap_conf_erb}"),
owner => 'root',
group => 'root',
mode => '0644',
notify => Service[$pureftpd::params::service_name]
}
}
require 'spec_helper'
describe 'pureftpd::config_ldap' do
let(:facts) { {:osfamily=> 'RedHat'} }
describe 'with no params' do
it do
# should contain_class('pureftpd::config_ldap')
should contain_file('/etc/pure-ftpd/pureftpd-ldap.conf').with_ensure('file')
end
end
end
$ bundle exec rake spec
HEAD is now at e8dcc69 Merge branch 'uriescape-use_default_escape_list'
/usr/bin/ruby18 -S rspec spec/classes/config_ldap_spec.rb spec/classes/pureftpd_spec.rb --color
F..
Failures:
1) pureftpd::config_ldap with no params
Failure/Error: should contain_file('/etc/pure-ftpd/pureftpd-ldap.conf').with_ensure('file')
Puppet::Error:
Could not find scope for pureftpd::params on node leo.tuc.noao.edu
# ./spec/classes/config_ldap_spec.rb:9
Finished in 1.04 seconds
3 examples, 1 failure
Failed examples:
rspec ./spec/classes/config_ldap_spec.rb:7 # pureftpd::config_ldap with no params
/usr/bin/ruby18 -S rspec spec/classes/config_ldap_spec.rb spec/classes/pureftpd_spec.rb --color failed
$ bundle list
Gems included by the bundle:
* bundler (1.3.5)
* diff-lcs (1.2.4)
* facter (1.7.2)
* hiera (1.2.1)
* json_pure (1.8.0)
* metaclass (0.0.1)
* mocha (0.14.0)
* puppet (3.2.3)
* puppet-lint (0.3.2)
* puppetlabs_spec_helper (0.4.1)
* rake (10.1.0)
* rgen (0.6.5)
* rspec (2.14.1)
* rspec-core (2.14.4)
* rspec-expectations (2.14.0)
* rspec-mocks (2.14.2)
* rspec-puppet (0.1.6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment