Hi,
On 06 Nov 2015, at 14:38, choffee <[email protected]> wrote:

> I have a define which takes a yaml file as a parameter and want to check that 
> my template creates valid yaml.
> 
> I am currently using regexp to test bits of it like so
> 
>   should contain_mydefine('foo').with_yaml_content(/---\s+-part1/m)

You can directly access the content attribute:

content = catalogue.resource(‘mydefine', ‘foo').send(:parameters)[:content]

Then you can use default spec matchers for checking what is in local variable 
content.
I am unsure how to check for valid yaml.

Best,
Martin



> 
> It would be nice to be able to do
> 
>   should contain_mydefine('foo').with_yaml_content.valid_yaml()
> 
> Is there a simple way to check this?
> 
> As an alternative, if I assign the yaml to a local available is there a way 
> in rspec to check that value?
> 
> Thanks
> 
> john
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" 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-users/79782f5f-f006-4094-a29e-3414ea7ba5c8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users/05756EAC-00D5-4869-AA38-3A27E8DA0404%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to