Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Puppet Camptocamp Postfix
Commits
e1ef97ab
Commit
e1ef97ab
authored
Nov 25, 2014
by
Raphaël Pinson
Browse files
Convert specs to rspec 3
parent
5f98c350
Changes
8
Hide whitespace changes
Inline
Side-by-side
spec/classes/postfix_augeas_spec.rb
View file @
e1ef97ab
...
...
@@ -13,13 +13,13 @@ describe 'postfix::augeas' do
"include ::augeas"
end
it
{
should
contain_augeas__lens
(
'postfix_transport'
).
with
(
it
{
is_expected
.
to
contain_augeas__lens
(
'postfix_transport'
).
with
(
:ensure
=>
'present'
,
:lens_source
=>
'puppet:///modules/postfix/lenses/postfix_transport.aug'
,
:test_source
=>
'puppet:///modules/postfix/lenses/test_postfix_transport.aug'
,
:stock_since
=>
'1.0.0'
)
}
it
{
should
contain_augeas__lens
(
'postfix_virtual'
).
with
(
it
{
is_expected
.
to
contain_augeas__lens
(
'postfix_virtual'
).
with
(
:ensure
=>
'present'
,
:lens_source
=>
'puppet:///modules/postfix/lenses/postfix_virtual.aug'
,
:test_source
=>
'puppet:///modules/postfix/lenses/test_postfix_virtual.aug'
,
...
...
spec/classes/postfix_mta_spec.rb
View file @
e1ef97ab
...
...
@@ -13,7 +13,7 @@ describe 'postfix::mta' do
}"
end
it
{
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'bar'
)
}
it
{
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'baz'
)
}
it
{
should
contain_postfix__config
(
'relayhost'
).
with_value
(
'foo'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'mydestination'
).
with_value
(
'bar'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'mynetworks'
).
with_value
(
'baz'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'relayhost'
).
with_value
(
'foo'
)
}
end
spec/classes/postfix_satellite_spec.rb
View file @
e1ef97ab
...
...
@@ -17,8 +17,8 @@ describe 'postfix::satellite' do
mynetworks => 'baz',
}"
end
it
{
should
contain_class
(
'postfix::mta'
)
}
it
{
should
contain_postfix__virtual
(
'@foo.example.com'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::mta'
)
}
it
{
is_expected
.
to
contain_postfix__virtual
(
'@foo.example.com'
).
with
(
:ensure
=>
'present'
,
:destination
=>
'root'
)
}
...
...
spec/classes/postfix_spec.rb
View file @
e1ef97ab
...
...
@@ -11,23 +11,23 @@ describe 'postfix' do
:path
=>
'/foo/bar'
,
}
}
it
{
should
contain_package
(
'postfix'
)
}
it
{
should
contain_package
(
'mailx'
)
}
it
{
is_expected
.
to
contain_package
(
'postfix'
)
}
it
{
is_expected
.
to
contain_package
(
'mailx'
)
}
it
{
should
contain_file
(
'/etc/mailname'
).
without
(
'seltype'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
should
contain_file
(
'/etc/aliases'
).
without
(
'seltype'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
should
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
)
}
it
{
should
contain_file
(
'/etc/postfix/main.cf'
).
without
(
'seltype'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/mailname'
).
without
(
'seltype'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/aliases'
).
without
(
'seltype'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
is_expected
.
to
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/postfix/main.cf'
).
without
(
'seltype'
)
}
it
{
should
contain_postfix__config
(
'myorigin'
).
with_value
(
'fqdn.example.com'
)
}
it
{
should
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
should
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'all'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'myorigin'
).
with_value
(
'fqdn.example.com'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'all'
)
}
it
{
should
contain_mailalias
(
'root'
).
with_recipient
(
'nobody'
)
}
it
{
is_expected
.
to
contain_mailalias
(
'root'
).
with_recipient
(
'nobody'
)
}
it
{
should
contain_service
(
'postfix'
).
with
(
is_expected
.
to
contain_service
(
'postfix'
).
with
(
:ensure
=>
'running'
,
:enable
=>
'true'
,
:hasstatus
=>
'true'
,
...
...
@@ -44,26 +44,26 @@ describe 'postfix' do
:path
=>
'/foo/bar'
,
}
}
it
{
should
contain_package
(
'postfix'
)
}
it
{
should
contain_package
(
'mailx'
)
}
it
{
is_expected
.
to
contain_package
(
'postfix'
)
}
it
{
is_expected
.
to
contain_package
(
'mailx'
)
}
it
{
should
contain_file
(
'/etc/mailname'
).
with_seltype
(
'postfix_etc_t'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
should
contain_file
(
'/etc/aliases'
).
with_seltype
(
'postfix_etc_t'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
should
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
should
contain_file
(
'/etc/postfix/master.cf'
).
with_seltype
(
'postfix_etc_t'
)
}
it
{
should
contain_file
(
'/etc/postfix/main.cf'
).
with_seltype
(
'postfix_etc_t'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/mailname'
).
with_seltype
(
'postfix_etc_t'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/aliases'
).
with_seltype
(
'postfix_etc_t'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
is_expected
.
to
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_seltype
(
'postfix_etc_t'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/postfix/main.cf'
).
with_seltype
(
'postfix_etc_t'
)
}
it
{
should
contain_postfix__config
(
'myorigin'
).
with_value
(
'fqdn.example.com'
)
}
it
{
should
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
should
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'all'
)
}
it
{
should
contain_postfix__config
(
'sendmail_path'
)
}
it
{
should
contain_postfix__config
(
'newaliases_path'
)
}
it
{
should
contain_postfix__config
(
'mailq_path'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'myorigin'
).
with_value
(
'fqdn.example.com'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'all'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'sendmail_path'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'newaliases_path'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'mailq_path'
)
}
it
{
should
contain_mailalias
(
'root'
).
with_recipient
(
'nobody'
)
}
it
{
is_expected
.
to
contain_mailalias
(
'root'
).
with_recipient
(
'nobody'
)
}
it
{
should
contain_service
(
'postfix'
).
with
(
is_expected
.
to
contain_service
(
'postfix'
).
with
(
:ensure
=>
'running'
,
:enable
=>
'true'
,
:hasstatus
=>
'true'
,
...
...
@@ -99,14 +99,14 @@ describe 'postfix' do
:master_submission
=>
'submission inet n - - - - smtpd'
,
}
}
it
{
should
contain_package
(
'postfix'
)
}
it
{
should
contain_package
(
'mailx'
)
}
it
{
is_expected
.
to
contain_package
(
'postfix'
)
}
it
{
is_expected
.
to
contain_package
(
'mailx'
)
}
it
{
should
contain_file
(
'/etc/mailname'
).
without
(
'seltype'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
should
contain_file
(
'/etc/aliases'
).
without
(
'seltype'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
should
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/mailname'
).
without
(
'seltype'
).
with_content
(
"fqdn.example.com
\n
"
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/aliases'
).
without
(
'seltype'
).
with_content
(
"# file managed by puppet
\n
"
)
}
it
{
is_expected
.
to
contain_exec
(
'newaliases'
).
with_refreshonly
(
'true'
)
}
it
{
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/smtp inet n - - - - smtpd/
).
with_content
(
/amavis unix/
...
...
@@ -126,16 +126,16 @@ describe 'postfix' do
/^submission inet n/
)
}
it
{
should
contain_file
(
'/etc/postfix/main.cf'
).
without
(
'seltype'
)
}
it
{
is_expected
.
to
contain_file
(
'/etc/postfix/main.cf'
).
without
(
'seltype'
)
}
it
{
should
contain_postfix__config
(
'myorigin'
).
with_value
(
'localhost'
)
}
it
{
should
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
should
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'localhost2'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'myorigin'
).
with_value
(
'localhost'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'alias_maps'
).
with_value
(
'hash:/etc/aliases'
)
}
it
{
is_expected
.
to
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'localhost2'
)
}
it
{
should
contain_mailalias
(
'root'
).
with_recipient
(
'foo'
)
}
it
{
is_expected
.
to
contain_mailalias
(
'root'
).
with_recipient
(
'foo'
)
}
it
{
should
contain_service
(
'postfix'
).
with
(
is_expected
.
to
contain_service
(
'postfix'
).
with
(
:ensure
=>
'running'
,
:enable
=>
'true'
,
:hasstatus
=>
'true'
,
...
...
@@ -158,7 +158,7 @@ describe 'postfix' do
:inet_interfaces
=>
'localhost2'
}
}
it
'should create a postfix::config defined type with inet_interfaces specified properly'
do
should
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'localhost2'
)
is_expected
.
to
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'localhost2'
)
end
end
context
'when enabling ldap'
do
...
...
@@ -171,7 +171,7 @@ describe 'postfix' do
:mail_user
=>
'bar'
}
}
it
'should adjust the content of /etc/postfix/master.cf specifying the user'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/user=bar/
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/user=bar/
)
end
end
context
'when mailman is true'
do
...
...
@@ -196,7 +196,7 @@ describe 'postfix' do
-o smtpd_client_restrictions=check_client_access,hash:/etc/postfix/access,reject"
,
}
}
it
'should update master.cf with the specified flags to smtp'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/smtp inet n - - - - smtpd/
).
with_content
(
/^smtp.*\n.*smtpd_client_restrictions=check_client_access,hash:/
)
...
...
@@ -207,19 +207,19 @@ describe 'postfix' do
:master_smtps
=>
'smtps inet n - - - - smtpd'
}
}
it
'should update master.cf with the specified flags to smtps'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/^smtps inet n/
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/^smtps inet n/
)
end
end
context
'when mta is enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should configure postfix as a minimal MTA, delivering mail to the mydestination param'
do
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
should
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
should
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
should
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
is_expected
.
to
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
is_expected
.
to
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
is_expected
.
to
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
is_expected
.
to
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
is_expected
.
to
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
end
it
{
should
contain_class
(
'postfix::mta'
)
}
it
{
is_expected
.
to
contain_class
(
'postfix::mta'
)
}
context
'and satellite is also enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should fail'
do
...
...
@@ -240,7 +240,7 @@ describe 'postfix' do
context
'when specifying myorigin'
do
let
(
:params
)
{
{
:myorigin
=>
'localhost'
}
}
it
'should create a postfix::config defined type with myorigin specified properly'
do
should
contain_postfix__config
(
'myorigin'
).
with_value
(
'localhost'
)
is_expected
.
to
contain_postfix__config
(
'myorigin'
).
with_value
(
'localhost'
)
end
end
context
'when specifying relayhost'
do
...
...
@@ -251,7 +251,7 @@ describe 'postfix' do
context
'when specifying a root_mail_recipient'
do
let
(
:params
)
{
{
:root_mail_recipient
=>
'foo'
}
}
it
'should contain a Mailalias resource directing roots mail to the required user'
do
should
contain_mailalias
(
'root'
).
with_recipient
(
'foo'
)
is_expected
.
to
contain_mailalias
(
'root'
).
with_recipient
(
'foo'
)
end
end
context
'when specifying satellite'
do
...
...
@@ -260,11 +260,11 @@ describe 'postfix' do
"class { 'augeas': }"
end
it
'should configure all local email to be forwarded to $root_mail_recipient delivered through $relayhost'
do
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
should
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
should
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
should
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
is_expected
.
to
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
is_expected
.
to
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
is_expected
.
to
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
is_expected
.
to
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
is_expected
.
to
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
end
context
'and mta is also enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
...
...
@@ -282,25 +282,25 @@ describe 'postfix' do
context
'when use_amavisd is true'
do
let
(
:params
)
{
{
:use_amavisd
=>
true
}
}
it
'should update master.cf with the specified flags to amavis'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/amavis unix/
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/amavis unix/
)
end
end
context
'when use_dovecot_lda is true'
do
let
(
:params
)
{
{
:use_dovecot_lda
=>
true
}
}
it
'should update master.cf with the specified flags to dovecot'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/dovecot.*\n.* user=vmail:vmail /
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/dovecot.*\n.* user=vmail:vmail /
)
end
end
context
'when use_schleuder is true'
do
let
(
:params
)
{
{
:use_schleuder
=>
true
}
}
it
'should update master.cf with the specified flags to schleuder'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/schleuder/
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/schleuder/
)
end
end
context
'when use_sympa is true'
do
let
(
:params
)
{
{
:use_sympa
=>
true
}
}
it
'should update master.cf to include sympa'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/sympa/
)
is_expected
.
to
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/sympa/
)
end
end
end
...
...
spec/defines/postfix_config_spec.rb
View file @
e1ef97ab
...
...
@@ -13,7 +13,7 @@ describe 'postfix::config' do
context
'when not passing value'
do
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
is_expected
.
to
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/value can not be empty/
)
end
end
...
...
@@ -24,7 +24,7 @@ describe 'postfix::config' do
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
is_expected
.
to
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["bar"\] is not a string/
)
end
end
...
...
@@ -36,7 +36,7 @@ describe 'postfix::config' do
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
is_expected
.
to
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["present"\] is not a string/
)
end
end
...
...
@@ -48,7 +48,7 @@ describe 'postfix::config' do
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
is_expected
.
to
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/must be either 'present', 'absent' or 'blank'/
)
end
end
...
...
@@ -59,7 +59,7 @@ describe 'postfix::config' do
:ensure
=>
'present'
,
}
}
it
{
should
contain_augeas
(
"set postfix 'foo' to 'bar'"
).
with
(
it
{
is_expected
.
to
contain_augeas
(
"set postfix 'foo' to 'bar'"
).
with
(
:incl
=>
'/etc/postfix/main.cf'
,
:lens
=>
'Postfix_Main.lns'
,
:changes
=>
"set foo 'bar'"
...
...
@@ -72,7 +72,7 @@ describe 'postfix::config' do
:ensure
=>
'absent'
,
}
}
it
{
should
contain_augeas
(
"rm postfix 'foo'"
).
with
(
it
{
is_expected
.
to
contain_augeas
(
"rm postfix 'foo'"
).
with
(
:incl
=>
'/etc/postfix/main.cf'
,
:lens
=>
'Postfix_Main.lns'
,
:changes
=>
"rm foo"
...
...
spec/defines/postfix_hash_spec.rb
View file @
e1ef97ab
...
...
@@ -16,7 +16,7 @@ describe 'postfix::hash' do
}
}
it
'should fail'
do
expect
{
should
contain_file
(
'/tmp/foo'
)
is_expected
.
to
contain_file
(
'/tmp/foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["present"\] is not a string/
)
end
end
...
...
@@ -27,7 +27,7 @@ describe 'postfix::hash' do
}
}
it
'should fail'
do
expect
{
should
contain_file
(
'/tmp/foo'
)
is_expected
.
to
contain_file
(
'/tmp/foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/must be either 'present' or 'absent'/
)
end
end
...
...
@@ -36,7 +36,7 @@ describe 'postfix::hash' do
let
(
:title
)
{
'foo'
}
it
'should fail'
do
expect
{
should
contain_file
(
'/tmp/foo'
)
is_expected
.
to
contain_file
(
'/tmp/foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/"foo" is not an absolute path/
)
end
end
...
...
@@ -49,7 +49,7 @@ describe 'postfix::hash' do
it
'should fail'
do
expect
{
should
contain_file
(
'/tmp/foo'
)
is_expected
.
to
contain_file
(
'/tmp/foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/You must provide either 'source' or 'content'/
)
end
end
...
...
@@ -59,13 +59,13 @@ describe 'postfix::hash' do
:source
=>
'/tmp/bar'
,
}
}
it
{
should
contain_file
(
'/tmp/foo'
).
with
(
it
{
is_expected
.
to
contain_file
(
'/tmp/foo'
).
with
(
:ensure
=>
'present'
,
:source
=>
'/tmp/bar'
).
without
(
:content
)
}
it
{
should
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
should
contain_exec
(
'generate /tmp/foo.db'
)
}
it
{
is_expected
.
to
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
is_expected
.
to
contain_exec
(
'generate /tmp/foo.db'
)
}
end
context
'when passing content'
do
...
...
@@ -73,22 +73,22 @@ describe 'postfix::hash' do
:content
=>
'bar'
,
}
}
it
{
should
contain_file
(
'/tmp/foo'
).
with
(
it
{
is_expected
.
to
contain_file
(
'/tmp/foo'
).
with
(
:ensure
=>
'present'
,
:content
=>
'bar'
).
without
(
:source
)
}
it
{
should
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
should
contain_exec
(
'generate /tmp/foo.db'
)
}
it
{
is_expected
.
to
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
is_expected
.
to
contain_exec
(
'generate /tmp/foo.db'
)
}
end
context
'when not passing source or content'
do
it
{
should
contain_file
(
'/tmp/foo'
).
with
(
it
{
is_expected
.
to
contain_file
(
'/tmp/foo'
).
with
(
:ensure
=>
'present'
).
without
(
:source
).
without
(
:content
)
}
it
{
should
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
should
contain_exec
(
'generate /tmp/foo.db'
)
}
it
{
is_expected
.
to
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'present'
)
}
it
{
is_expected
.
to
contain_exec
(
'generate /tmp/foo.db'
)
}
end
context
'when ensuring absence'
do
...
...
@@ -96,8 +96,8 @@ describe 'postfix::hash' do
:ensure
=>
'absent'
,
}
}
it
{
should
contain_file
(
'/tmp/foo'
).
with_ensure
(
'absent'
)
}
it
{
should
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'absent'
)
}
it
{
should
contain_exec
(
'generate /tmp/foo.db'
)
}
it
{
is_expected
.
to
contain_file
(
'/tmp/foo'
).
with_ensure
(
'absent'
)
}
it
{
is_expected
.
to
contain_file
(
'/tmp/foo.db'
).
with_ensure
(
'absent'
)
}
it
{
is_expected
.
to
contain_exec
(
'generate /tmp/foo.db'
)
}
end
end
spec/defines/postfix_transport_spec.rb
View file @
e1ef97ab
...
...
@@ -19,7 +19,7 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["bar"\] is not a string/
)
end
end
...
...
@@ -32,7 +32,7 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["baz"\] is not a string/
)
end
end
...
...
@@ -45,7 +45,7 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["baz"\] is not a string/
)
end
end
...
...
@@ -58,7 +58,7 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/"baz" is not an absolute path/
)
end
end
...
...
@@ -71,7 +71,7 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["baz"\] is not a string/
)
end
end
...
...
@@ -84,14 +84,14 @@ describe 'postfix::transport' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix transport - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\$ensure must be either/
)
end
end
context
'when using default values'
do
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix transport - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
).
with
(
:incl
=>
'/etc/postfix/transport'
,
:lens
=>
'Postfix_Transport.lns'
,
:changes
=>
[
...
...
@@ -110,8 +110,8 @@ describe 'postfix::transport' do
:ensure
=>
'present'
,
}
}
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix transport - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
).
with
(
:incl
=>
'/tmp/transport'
,
:lens
=>
'Postfix_Transport.lns'
,
:changes
=>
[
...
...
@@ -128,8 +128,8 @@ describe 'postfix::transport' do
:ensure
=>
'absent'
,
}
}
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix transport - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix transport - foo'
).
with
(
:incl
=>
'/etc/postfix/transport'
,
:lens
=>
'Postfix_Transport.lns'
,
:changes
=>
[
...
...
spec/defines/postfix_virtual_spec.rb
View file @
e1ef97ab
...
...
@@ -15,7 +15,7 @@ describe 'postfix::virtual' do
context
'when not sending destination'
do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/Must pass destination/
)
end
end
...
...
@@ -27,7 +27,7 @@ describe 'postfix::virtual' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["bar"\] is not a string/
)
end
end
...
...
@@ -40,7 +40,7 @@ describe 'postfix::virtual' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["baz"\] is not a string/
)
end
end
...
...
@@ -53,7 +53,7 @@ describe 'postfix::virtual' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/"baz" is not an absolute path/
)
end
end
...
...
@@ -66,7 +66,7 @@ describe 'postfix::virtual' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["baz"\] is not a string/
)
end
end
...
...
@@ -79,7 +79,7 @@ describe 'postfix::virtual' do
it
'should fail'
do
expect
{
should
contain_augeas
(
'Postfix virtual - foo'
)
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
)
}.
to
raise_error
(
Puppet
::
Error
,
/\$ensure must be either/
)
end
end
...
...
@@ -89,8 +89,8 @@ describe 'postfix::virtual' do
:destination
=>
'bar'
,
}
}
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix virtual - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
).
with
(
:incl
=>
'/etc/postfix/virtual'
,
:lens
=>
'Postfix_Virtual.lns'
,
:changes
=>
[
...
...
@@ -107,8 +107,8 @@ describe 'postfix::virtual' do
:ensure
=>
'present'
,
}
}
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix virtual - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
).
with
(
:incl
=>
'/tmp/virtual'
,
:lens
=>
'Postfix_Virtual.lns'
,
:changes
=>
[
...
...
@@ -124,8 +124,8 @@ describe 'postfix::virtual' do
:ensure
=>
'absent'
,
}
}
it
{
should
contain_class
(
'postfix::augeas'
)
}
it
{
should
contain_augeas
(
'Postfix virtual - foo'
).
with
(
it
{
is_expected
.
to
contain_class
(
'postfix::augeas'
)
}
it
{
is_expected
.
to
contain_augeas
(
'Postfix virtual - foo'
).
with
(
:incl
=>
'/etc/postfix/virtual'
,
:lens
=>
'Postfix_Virtual.lns'
,
:changes
=>
[
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment