title: How to mock puppet validate_cmd in puppet using rspec?
body: <p>I have a puppet cookbook rspec sample test like below</p>
  
  <pre class="lang-ruby prettyprint-override"><code>it {
    is_expected.to contain_file('/etc/resolv.conf')
      .with(
        'ensure' =&gt; 'file',
        'owner' =&gt; 'root',
        'group' =&gt; 'root',
        'mode' =&gt; '0444',
        'validate_cmd' =&gt; '/var/tmp/checkdns_nameservers.sh',
      )
      .with_content(resolvconf_contents)
      .that_notifies('Service[sshd]')
      .that_notifies('Service[nscd]')
  }
  </code></pre>
  
  <p>The problem is that this just checks the  existence of validate_cmd in the manifest. </p>
  
  <p>I have to mock the validate_cmd function and returns true/false and Based on that I have to check the contents of the file newly created.
  How can I mock the validate_cmd command using rspec module ?
  Any help would be highly appreciated !!</p>