On Friday, May 8, 2015 at 12:19:51 PM UTC+1, Erik Dalén wrote:
>
>
>
> On Thu, 7 May 2015 at 13:16 David Schmitt <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>>
>> On Tuesday, April 28, 2015 at 3:54:09 PM UTC+1, henrik lindberg wrote:
>>>
>>> On 2015-28-04 15:16, Erik Dalén wrote: 
>>> > Do any of you have any tips in regards to unit testing function using 
>>> > the v4 API in modules? 
>>> > 
>>> > I would like to do something like this: 
>>> > 
>>> https://github.com/puppetlabs/puppet/blob/master/spec/unit/functions/scanf_spec.rb
>>>  
>>> > 
>>> > But PuppetSpec::Compiler & Matchers::Resource are in the spec/lib 
>>> > directory of puppet which I can't depend on from a module AFAIK. 
>>> > 
>>> > Is there something equivalent in puppetlabs_spec_helper that works for 
>>> > v4 API functions? 
>>> > 
>>> There is an updated version of puppet-rspec that will help with this. (I 
>>> heard about this yesterday). Hunner knows more. 
>>>
>>
>> rspec-puppet 2.1.0 should have all that work. There are a few more 
>> patches and bug fixes in the pipeline, but 2.1.0 should already get you far.
>>
>> Some examples of rspec-puppet only function testing can be found in the 
>> upcoming refresh of stdlib's function specs, currently in my WIP branch 
>> here:
>>
>>
>> https://github.com/DavidS/puppetlabs-stdlib/commits/modules-1882-rspec-puppet-migration
>>
>>
>>
> It seems like you only have one function using the v4 API (type_of), and 
> the unit test for that is only run on Puppet 4.0, but the travis matrix 
> doesn't specify puppet 4.0 at all. So the test for that doesn't run. Does 
> it work if you try it locally with Puppet 4.0?
>
>
> To demonstrate the issue I created a minimal test module (
> https://github.com/dalen/puppet-v4functiontest), and it still doesn't 
> work with rspec-puppet 2.1.0: 
> https://travis-ci.org/dalen/puppet-v4functiontest/builds/60517933
>
> Do you have any idea what is wrong with that code?
>

No, but I've been able to reproduce this now locally and I'll have a look 
at what's going on there.


Regards, David 

-- 
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/9d3940a6-60a2-4c6a-ab0d-1b9af31cb955%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to