summaryrefslogtreecommitdiffstats
path: root/spec/unit/faces/configurer_spec.rb
blob: 6982c00ae5648930eef813193eeec46c25e832c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env ruby

require 'spec_helper'
require 'puppet/indirector/catalog/rest'
require 'tempfile'

describe Puppet::Faces[:configurer, '0.0.1'] do
  describe "#synchronize" do
    it "should retrieve and apply a catalog and return a report" do
      pending "REVISIT: 2.7 changes broke this, and we want the merge published"

      dirname = Dir.mktmpdir("puppetdir")
      Puppet[:vardir] = dirname
      Puppet[:confdir] = dirname
      @catalog = Puppet::Resource::Catalog.new
      @file = Puppet::Resource.new(:file, File.join(dirname, "tmp_dir_resource"), :parameters => {:ensure => :present})
      @catalog.add_resource(@file)
      Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog)

      report = subject.synchronize("foo")

      report.kind.should   == "apply"
      report.status.should == "changed"
    end
  end
end