voxpupuli / puppet-postfix

Puppet postfix module
Apache License 2.0
70 stars 172 forks source link

remove unneeded tests; provide error message for raise_error #318

Closed kenyon closed 2 years ago

kenyon commented 2 years ago

Tests for wrong parameter data types aren't really needed since Puppet will do the type checking itself. These tests also caused warnings because they didn't provide specific error messages to the raise_error matcher.

Also, provide error messages to the remaining raise_error matches that lacked error messages, to avoid warnings like this:

WARNING: Using the `raise_error` matcher without providing a specific
error or message risks false positives, since `raise_error` will match
when Ruby raises a `NoMethodError`, `NameError` or `ArgumentError`,
potentially allowing the expectation to pass without even executing
the method you are intending to call. Actual error raised was
a Resource Statement, Postfix::... expects a match for Enum['absent',
'present'], got Tuple (line: 5) on node lithium.kenyonralph.com>.
Instead consider provi ding a specific error class or message. This
message can be suppressed by setting:
`RSpec::Expectations.configuration.on_potential_false_positives =
:nothing`. Called from /home/kenyon/git/
puppet-postfix/spec/defines/postfix_virtual_spec.rb:88:in `block (5
levels) in <top (required)>'.