Hi Simon,
On Apr 29, 2013, at 7:45 PM, Simon Piette <piette.si...@gmail.com>
 wrote:

> Hi all,
> <snip>
> Any solution for testing variables that depends on settings will be welcome.
>
> Thanks,

I sent this last night from another account, but it didn't seem to go through:




What I've done elsewhere is to make a parameter for, in your case, vardir:


(untested, but close)

Class foo($vardir = $::settings::vardir){
file { "${vardir}/files":
  ensure => directory
}
}


Then in
spec/classes/foo_main_spec.rb:
require 'spec_helper'
require 'puppetlabs_spec_helper/module_spec_helper'
vartest = Puppet.settings[:vardir]
describe 'foo', :type => :class do
  #...
  #Then you can assign vartest as a class parameter to your tests.
end





Hope that helps.

W

________________________________

This message may contain confidential or privileged information. If you are not 
the intended recipient, please advise us immediately and delete this message. 
See http://www.datapipe.com/legal/email_disclaimer/ for further information on 
confidentiality and the risks of non-secure electronic communication. If you 
cannot access these links, please notify us by reply message and we will send 
the contents to you.

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to