Sha256: 41445f382c497c9c079dc97c382370f265cde424697030e50e27f4857b92ef2d

Contents?: true

Size: 958 Bytes

Versions: 5

Compression:

Stored size: 958 Bytes

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

require 'puppet_spec/files'

require 'puppet/application/apply'

describe "apply" do
  include PuppetSpec::Files

  describe "when applying provided catalogs" do
    confine "PSON library is missing; cannot test applying catalogs" => Puppet.features.pson?
    it "should be able to apply catalogs provided in a file in pson" do
      file_to_create = tmpfile("pson_catalog")
      catalog = Puppet::Resource::Catalog.new
      resource = Puppet::Resource.new(:file, file_to_create, :parameters => {:content => "my stuff"})
      catalog.add_resource resource

      manifest = tmpfile("manifest")

      File.open(manifest, "w") { |f| f.print catalog.to_pson }

      puppet = Puppet::Application[:apply]
      puppet.options[:catalog] = manifest

      puppet.apply

      File.should be_exist(file_to_create)
      File.read(file_to_create).should == "my stuff"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puppet-2.6.4 spec/integration/application/apply_spec.rb
puppet-2.6.3 spec/integration/application/apply_spec.rb
puppet-2.6.2 spec/integration/application/apply_spec.rb
puppet-2.6.1 spec/integration/application/apply_spec.rb
puppet-2.6.0 spec/integration/application/apply_spec.rb