I'm not sure if it can be done, but I am trying to test a case where I take
an array of values and use stdlib's delete to remove one value before
iterating over it. The class will fail if the removed value is present.
That all works fine except I am trying to write an rspec for it. Nothing I
have found seems to have a way I can figure out to do this.
class my_class {
$var1 = ['a','b','c']
$var2 = delete($var1, 'b') ==> Now ['a','c']
$var2.each |$var3| {
if $var3 == 'b' {
fail("Found b")
}
}
}
I am trying to mock / stub is before testing do $var2 = ['a','b','c'] to
override the calculated $var2 from the delete function.
What am I missing here?
I tried let(:vars) {{ var2: ['a','b','c'] }}, which didn't work.
Did a similar thing with a mock on my_class.new, but the value remained as
calculated by the class.
Is it even possible to stub a local variable to the class / module to force
a failure condition?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/10220b50-b89d-46a4-8a8f-b1cbfac87f2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.