# File lib/rspec-puppet/support.rb, line 180
    def build_catalog_without_cache(nodename, facts_val, hiera_config_val, code)

      # If we're going to rebuild the catalog, we should clear the cached instance
      # of Hiera that Puppet is using.  This opens the possibility of the catalog
      # now being rebuilt against a differently configured Hiera (i.e. :hiera_config
      # set differently in one example group vs. another).
      # It would be nice if Puppet offered a public API for invalidating their
      # cached instance of Hiera, but que sera sera.  We will go directly against
      # the implementation out of absolute necessity.
      HieraPuppet.instance_variable_set('@hiera', nil) if defined? HieraPuppet

      Puppet[:code] = code

      stub_facts! facts_val

      node_obj = Puppet::Node.new(nodename)

      node_obj.merge(facts_val)

      # trying to be compatible with 2.7 as well as 2.6
      if Puppet::Resource::Catalog.respond_to? :find
        Puppet::Resource::Catalog.find(node_obj.name, :use_node => node_obj)
      elsif Puppet.version.to_f >= 4.0
        env = Puppet::Node::Environment.create(
          environment,
          [File.join(Puppet[:environmentpath],'fixtures','modules')],
          File.join(Puppet[:environmentpath],'fixtures','manifests'))
        loader = Puppet::Environments::Static.new(env)
        Puppet.override({:environments => loader}, 'fixtures') do
          node_obj.environment = env
          Puppet::Resource::Catalog.indirection.find(node_obj.name, :use_node => node_obj)
        end
      else
        Puppet::Resource::Catalog.indirection.find(node_obj.name, :use_node => node_obj)
      end
    end