Re: [Puppet-dev] It is possible to mock / stub a local variable in the module being tested?

2017-07-25 Thread Ryan Whitehurst
On Tue, Jul 25, 2017 at 3:15 PM, James Perry wrote: > So I am over thinking it then. I'm taking fact values from a list of > installed directories and removing the one matching the current version. > This is being used to remove the old install directories and I didn't want > it to whack the cur

Re: [Puppet-dev] It is possible to mock / stub a local variable in the module being tested?

2017-07-25 Thread James Perry
So I am over thinking it then. I'm taking fact values from a list of installed directories and removing the one matching the current version. This is being used to remove the old install directories and I didn't want it to whack the current version. I wanted to test that having the local varia

Re: [Puppet-dev] It is possible to mock / stub a local variable in the module being tested?

2017-07-25 Thread Ryan Whitehurst
On Tue, Jul 25, 2017 at 2:33 PM, James Perry wrote: > 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

[Puppet-dev] It is possible to mock / stub a local variable in the module being tested?

2017-07-25 Thread James Perry
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 ha

[Puppet-dev] Re: So how exactly the immutable hashes are supposed to be used?

2017-07-25 Thread Henrik Lindberg
On 13/07/17 19:00, Mariusz Gronczewski wrote: Hi, I've been slowly converting old 3.x codebase (which has seen days of 0.24...) to 4.x and there is a lot of following pattern used for hashes:' $hash = { "some" => "defaults" } if $thing_one == "is_true" { $hash["

Re: [Puppet-dev] Puppet Rspec - Check against Catalogue Value

2017-07-25 Thread James Perry
Thanks David. Simple things seem more complex with RSpec than they should be. On Tuesday, July 25, 2017 at 6:14:55 AM UTC-4, David Schmitt wrote: > > > > On 25 July 2017 at 00:21, James Perry > > wrote: > >> So I have a simple class, for now, where I am trying to write RSPEC tests >> to check

Re: [Puppet-dev] Puppet Rspec - Check against Catalogue Value

2017-07-25 Thread David Schmitt
On 25 July 2017 at 00:21, James Perry wrote: > So I have a simple class, for now, where I am trying to write RSPEC tests > to check the following: > > 1. Smart Parameter $current_version is in catalogue. > 2. If $current_version = $installed_version (custom fact that will be > stubbed as a :fact)