You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
context "with no default algorithm set" do
let(:node_params) do
super().merge(
'foo::default_algorithm' => :undef,
)
end
it { is_expected.to
compile.and_raise_error(%r{.*default algorithm must be set.*}) }
end
and the following in a puppet class:
class foo::bar {
$default_algorithm = $foo::default_algorithm
if (!$default_algorithm) {
fail("default algorithm must be set")
}
}
I would expect that the test should pass however the catalogue compiles instead of raising an error as the :undef symbol is seen as the string 'undef' so the if statement evaluates to true.
The way around this is to change my puppet code to be:
if ($default_algorithm == undef or $default_algorithm == 'undef') {
The text was updated successfully, but these errors were encountered:
I have the following excerpt from a spec:
and the following in a puppet class:
I would expect that the test should pass however the catalogue compiles instead of raising an error as the :undef symbol is seen as the string 'undef' so the if statement evaluates to true.
The way around this is to change my puppet code to be:
if ($default_algorithm == undef or $default_algorithm == 'undef') {
The text was updated successfully, but these errors were encountered: