Skip to content

Commit

Permalink
Use without instead of checking for nil in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smoeding committed Nov 11, 2023
1 parent ed45936 commit 8ad45fc
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 96 deletions.
16 changes: 8 additions & 8 deletions spec/classes/access_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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]')
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/access_spec.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/aliases_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/aliases_spec.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/authinfo_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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]')
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/authinfo_spec.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/domaintable_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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]')
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/domaintable_spec.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/genericstable_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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]')
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/genericstable_spec.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/mailertable_file_spec.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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]')
}
Expand Down

0 comments on commit 8ad45fc

Please sign in to comment.