title: can you override paramterized class variables in rspec-puppet?
body: <p>I am retrofitting unit tests to an existing module (not authored by myself). I can't seem to override the params class <code>undef</code> value to a <code>hash</code> value.</p>
  
  <p><strong>the params class has the following (excerpt only):</strong></p>
  
  <pre><code>class myclass::params {
   splunk = undef,
   ...
  }
  </code></pre>
  
  <p><strong>Main class (excerpt only):</strong></p>
  
  <pre><code>class myclass(
    $splunk = $myclass::params::splunk,
    ...
  ) inherits ::myclass::params
  {...}
  </code></pre>
  
  <p><strong>And the following config class (excerpt only):</strong></p>
  
  <pre><code>class mylcass::config inherits myclass{
  
    if  $myclass::splunk['install']['package_manage'] {
      file { "somefile.conf":
       ensure  =&gt; file,
       mode    =&gt; '0444',
       source  =&gt; 'puppet:///modules/myclass/splunk/somefile.conf',
  }
     ...
    }
  }
  </code></pre>
  
  <p><strong>In config_spec.rb file I have the following:</strong></p>
  
  <pre><code>require 'spec_helper'
  require 'shared_contexts'
  
  describe 'myclass::splunk::config' do
  
    hiera = Hiera.new(:config =&gt; 'spec/fixtures/hiera/hiera.yaml')
    splunk = hiera.lookup('splunk',nil,nil)
  
    let(:params) do
      {
      }
    end
  
    it do
      is_expected.to contain_file('somefile.conf')
        .with(
          'ensure' =&gt; 'file',
          'mode'   =&gt; '0444',
          'source' =&gt; 'puppet:///modules/myclass/splunk/somefile.conf'
        )
    end
  
  end
  </code></pre>
  
  <p>I plugged the hiera lookup for <code>splunk</code> into the myclass_spec.rb file in the hope it will override:</p>
  
  <pre><code>require 'spec_helper'
  require 'shared_contexts'
  
  describe 'myclass' do
  
    hiera = Hiera.new(:config =&gt; 'spec/fixtures/hiera/hiera.yaml')
    splunk = hiera.lookup('splunk',nil,nil)
  
  let(:params) do
      {
        :splunk =&gt; splunk
        ...
      }
  </code></pre>
  
  <p>But I continue to get the following error:</p>
  
  <pre><code>myclass::splunk is not a hash or array when accessing it
  </code></pre>
  
  <p>How do I override the <code>splunk</code> variable?</p>