title: rspec-puppet how to test for a define as a member of a class
body: <p>I have a class which looks like</p>
  
  <pre><code>class addon {
      case $::operatingsystem {
      'windows': {
          Dsc_xfirewall {
              dsc_ensure    =&gt; 'Present',
          }
       }
       'RedHat': {
       }
       default: { warning "OS : ${::operatingsystem} is not (yet) supported" }
    }
  }
  </code></pre>
  
  <p>and I would like my test to look like </p>
  
  <pre><code>describe 'addon', :type =&gt; :class do
      os = 'windows'
      let(:facts) {{:operatingsystem =&gt; os}}
      describe os do
          it {
              is_expected.to contain_class('addon').with(
                {
                  :Dsc_xfirewall =&gt; {
                    :dsc_ensure =&gt; 'Present',
                  }
                }
              )
          }
      end
  end
  </code></pre>
  
  <p>The catalog compiles correctly, the is_expected.to compile is removed for clarity. However I can't seem to get this to work: dsc_xfirewall is nil, if I try Dsc_xfirewall same story and if try </p>
  
  <pre><code>contains_dsc_xfirewall
  </code></pre>
  
  <p>I get an error that dsc_firewall is not a valid define. Does anyone have any ideas how I can better structure my test? Before anyone points out that if the catalog compiles correctly I don't need this test, I know that; this is just a cooked down version of something more complex.</p>
  
  <p>My question is therefore: what does the test have to look like to check that the class contains dsc_xfirewall and that all the parameters are set correctly?</p>