From 8ad45fc21b9ca7674fabd2e5ebff4645f2582d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mo=CC=88ding?= Date: Sat, 11 Nov 2023 15:10:54 +0100 Subject: [PATCH] Use without instead of checking for nil in tests --- spec/classes/access_file_spec.rb | 16 ++++++------- spec/classes/access_spec.rb | 4 ++-- spec/classes/aliases_file_spec.rb | 16 ++++++------- spec/classes/aliases_spec.rb | 4 ++-- spec/classes/authinfo_file_spec.rb | 16 ++++++------- spec/classes/authinfo_spec.rb | 4 ++-- spec/classes/domaintable_file_spec.rb | 16 ++++++------- spec/classes/domaintable_spec.rb | 4 ++-- spec/classes/genericstable_file_spec.rb | 16 ++++++------- spec/classes/genericstable_spec.rb | 4 ++-- spec/classes/mailertable_file_spec.rb | 16 ++++++------- spec/classes/mailertable_spec.rb | 4 ++-- spec/classes/nullclient_spec.rb | 32 ++++++++++++------------- spec/classes/userdb_file_spec.rb | 16 ++++++------- spec/classes/userdb_spec.rb | 4 ++-- spec/classes/virtusertable_file_spec.rb | 16 ++++++------- spec/classes/virtusertable_spec.rb | 4 ++-- 17 files changed, 96 insertions(+), 96 deletions(-) diff --git a/spec/classes/access_file_spec.rb b/spec/classes/access_file_spec.rb index dc3ef38..d7cada9 100644 --- a/spec/classes/access_file_spec.rb +++ b/spec/classes/access_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::access::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::access::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -54,7 +54,7 @@ is_expected.to contain_file('/etc/mail/access') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -69,7 +69,7 @@ it { is_expected.to contain_file('/etc/mail/access') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/access_spec.rb b/spec/classes/access_spec.rb index 7b903f5..023d44b 100644 --- a/spec/classes/access_spec.rb +++ b/spec/classes/access_spec.rb @@ -15,7 +15,7 @@ is_expected.to contain_class('sendmail::access') is_expected.to contain_class('sendmail::access::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -29,7 +29,7 @@ it { is_expected.to contain_class('sendmail::access') is_expected.to contain_class('sendmail::access::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/aliases_file_spec.rb b/spec/classes/aliases_file_spec.rb index 3d36ac9..db1ab8c 100644 --- a/spec/classes/aliases_file_spec.rb +++ b/spec/classes/aliases_file_spec.rb @@ -15,8 +15,8 @@ .with_owner('root') .with_group('root') .with_mode('0644') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::aliases::newaliases]') when 'FreeBSD' is_expected.to contain_class('sendmail::aliases::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0644') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::aliases::newaliases]') end } @@ -45,13 +45,13 @@ is_expected.to contain_file('/etc/aliases') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::aliases::newaliases]') when 'FreeBSD' is_expected.to contain_file('/etc/mail/aliases') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::aliases::newaliases]') end } @@ -68,13 +68,13 @@ when 'Debian', 'RedHat' is_expected.to contain_file('/etc/aliases') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::aliases::newaliases]') when 'FreeBSD' is_expected.to contain_file('/etc/mail/aliases') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::aliases::newaliases]') end diff --git a/spec/classes/aliases_spec.rb b/spec/classes/aliases_spec.rb index e2fc518..2841f55 100644 --- a/spec/classes/aliases_spec.rb +++ b/spec/classes/aliases_spec.rb @@ -12,7 +12,7 @@ is_expected.to contain_class('sendmail::aliases') is_expected.to contain_class('sendmail::aliases::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -25,7 +25,7 @@ it { is_expected.to contain_class('sendmail::aliases') is_expected.to contain_class('sendmail::aliases::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/authinfo_file_spec.rb b/spec/classes/authinfo_file_spec.rb index 121f862..748db0f 100644 --- a/spec/classes/authinfo_file_spec.rb +++ b/spec/classes/authinfo_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('root') .with_group('smmsp') .with_mode('0600') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::authinfo::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0600') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::authinfo::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0600') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -53,7 +53,7 @@ is_expected.to contain_file('/etc/mail/authinfo') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -67,7 +67,7 @@ it { is_expected.to contain_file('/etc/mail/authinfo') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/authinfo_spec.rb b/spec/classes/authinfo_spec.rb index f810216..e842455 100644 --- a/spec/classes/authinfo_spec.rb +++ b/spec/classes/authinfo_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::authinfo') is_expected.to contain_class('sendmail::authinfo::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -27,7 +27,7 @@ it { is_expected.to contain_class('sendmail::authinfo') is_expected.to contain_class('sendmail::authinfo::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/domaintable_file_spec.rb b/spec/classes/domaintable_file_spec.rb index 12ec662..3d61a5f 100644 --- a/spec/classes/domaintable_file_spec.rb +++ b/spec/classes/domaintable_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::domaintable::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::domaintable::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -53,7 +53,7 @@ is_expected.to contain_file('/etc/mail/domaintable') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -67,7 +67,7 @@ it { is_expected.to contain_file('/etc/mail/domaintable') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/domaintable_spec.rb b/spec/classes/domaintable_spec.rb index 1ffe854..4f5a630 100644 --- a/spec/classes/domaintable_spec.rb +++ b/spec/classes/domaintable_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::domaintable') is_expected.to contain_class('sendmail::domaintable::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -27,7 +27,7 @@ it { is_expected.to contain_class('sendmail::domaintable') is_expected.to contain_class('sendmail::domaintable::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/genericstable_file_spec.rb b/spec/classes/genericstable_file_spec.rb index 687a052..093ed7c 100644 --- a/spec/classes/genericstable_file_spec.rb +++ b/spec/classes/genericstable_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::genericstable::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::genericstable::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -53,7 +53,7 @@ is_expected.to contain_file('/etc/mail/genericstable') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -67,7 +67,7 @@ it { is_expected.to contain_file('/etc/mail/genericstable') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/genericstable_spec.rb b/spec/classes/genericstable_spec.rb index 6723bb1..8c96132 100644 --- a/spec/classes/genericstable_spec.rb +++ b/spec/classes/genericstable_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::genericstable') is_expected.to contain_class('sendmail::genericstable::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -27,7 +27,7 @@ it { is_expected.to contain_class('sendmail::genericstable') is_expected.to contain_class('sendmail::genericstable::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/mailertable_file_spec.rb b/spec/classes/mailertable_file_spec.rb index 7aeafa8..0e52446 100644 --- a/spec/classes/mailertable_file_spec.rb +++ b/spec/classes/mailertable_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0644') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::mailertable::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0644') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::mailertable::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0644') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -54,7 +54,7 @@ is_expected.to contain_file('/etc/mail/mailertable') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -69,7 +69,7 @@ it { is_expected.to contain_file('/etc/mail/mailertable') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/mailertable_spec.rb b/spec/classes/mailertable_spec.rb index 1e486e2..61c6194 100644 --- a/spec/classes/mailertable_spec.rb +++ b/spec/classes/mailertable_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::mailertable') is_expected.to contain_class('sendmail::mailertable::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -27,7 +27,7 @@ it { is_expected.to contain_class('sendmail::mailertable') is_expected.to contain_class('sendmail::mailertable::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/nullclient_spec.rb b/spec/classes/nullclient_spec.rb index 8fa4b37..eeae167 100644 --- a/spec/classes/nullclient_spec.rb +++ b/spec/classes/nullclient_spec.rb @@ -11,26 +11,26 @@ it { is_expected.to contain_class('sendmail::nullclient') is_expected.to contain_class('sendmail') - .with_domain_name(nil) - .with_max_message_size(nil) + .without_domain_name + .without_max_message_size .with_dont_probe_interfaces(true) .with_enable_ipv4_daemon(false) .with_enable_ipv6_daemon(false) .with_mailers([]) .with_trusted_users([]) .with_enable_msp_trusted_users(false) - .with_ca_cert_file(nil) - .with_ca_cert_path(nil) - .with_server_cert_file(nil) - .with_server_key_file(nil) - .with_client_cert_file(nil) - .with_client_key_file(nil) - .with_crl_file(nil) - .with_dh_params(nil) - .with_tls_srv_options(nil) - .with_cipher_list(nil) - .with_server_ssl_options(nil) - .with_client_ssl_options(nil) + .without_ca_cert_file + .without_ca_cert_path + .without_server_cert_file + .without_server_key_file + .without_client_cert_file + .without_client_key_file + .without_crl_file + .without_dh_params + .without_tls_srv_options + .without_cipher_list + .without_server_ssl_options + .without_client_ssl_options is_expected.to contain_sendmail__mc__feature('no_default_msa') @@ -39,14 +39,14 @@ .with_family('inet') .with_addr('127.0.0.1') .with_port('587') - .with_modify(nil) + .without_modify is_expected.to contain_sendmail__mc__daemon_options('MSA-v6') .with_daemon_name('MSA') .with_family('inet6') .with_addr('::1') .with_port('587') - .with_modify(nil) + .without_modify is_expected.to contain_sendmail__mc__feature('nullclient') .with_args(['example.com']) diff --git a/spec/classes/userdb_file_spec.rb b/spec/classes/userdb_file_spec.rb index 8902230..f906c0f 100644 --- a/spec/classes/userdb_file_spec.rb +++ b/spec/classes/userdb_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::userdb::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::userdb::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -55,7 +55,7 @@ is_expected.to contain_file('/etc/mail/userdb') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -71,7 +71,7 @@ is_expected.to contain_class('sendmail::userdb::file') is_expected.to contain_file('/etc/mail/userdb') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/userdb_spec.rb b/spec/classes/userdb_spec.rb index ddecc46..0e69791 100644 --- a/spec/classes/userdb_spec.rb +++ b/spec/classes/userdb_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::userdb') is_expected.to contain_class('sendmail::userdb::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -26,7 +26,7 @@ it { is_expected.to contain_class('sendmail::userdb') is_expected.to contain_class('sendmail::userdb::file') - .with_content(nil) + .without_content .with_source('foo') } end diff --git a/spec/classes/virtusertable_file_spec.rb b/spec/classes/virtusertable_file_spec.rb index 9aae93f..e261522 100644 --- a/spec/classes/virtusertable_file_spec.rb +++ b/spec/classes/virtusertable_file_spec.rb @@ -16,8 +16,8 @@ .with_owner('smmta') .with_group('smmsp') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'RedHat' is_expected.to contain_class('sendmail::virtusertable::file') @@ -26,8 +26,8 @@ .with_owner('root') .with_group('root') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') when 'FreeBSD' is_expected.to contain_class('sendmail::virtusertable::file') @@ -36,8 +36,8 @@ .with_owner('root') .with_group('wheel') .with_mode('0640') - .with_content(nil) - .with_source(nil) + .without_content + .without_source .that_notifies('Class[sendmail::makeall]') end } @@ -54,7 +54,7 @@ is_expected.to contain_file('/etc/mail/virtusertable') .with_ensure('file') .with_content('foo') - .with_source(nil) + .without_source .that_notifies('Class[sendmail::makeall]') } end @@ -69,7 +69,7 @@ it { is_expected.to contain_file('/etc/mail/virtusertable') .with_ensure('file') - .with_content(nil) + .without_content .with_source('foo') .that_notifies('Class[sendmail::makeall]') } diff --git a/spec/classes/virtusertable_spec.rb b/spec/classes/virtusertable_spec.rb index 3f04658..c832928 100644 --- a/spec/classes/virtusertable_spec.rb +++ b/spec/classes/virtusertable_spec.rb @@ -14,7 +14,7 @@ is_expected.to contain_class('sendmail::virtusertable') is_expected.to contain_class('sendmail::virtusertable::file') .with_content('foo') - .with_source(nil) + .without_source } end @@ -26,7 +26,7 @@ it { is_expected.to contain_class('sendmail::virtusertable') is_expected.to contain_class('sendmail::virtusertable::file') - .with_content(nil) + .without_content .with_source('foo') } end