summaryrefslogtreecommitdiffstats
path: root/spec/unit/face/secret_agent_spec.rb
blob: 2530d144d4a7358d7778857ce59437bb3a504e1a (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
27
#!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/face'
require 'puppet/indirector/catalog/rest'
require 'tempfile'

describe Puppet::Face[:secret_agent, '0.0.1'] do
  include PuppetSpec::Files

  describe "#synchronize" do
    it "should retrieve and apply a catalog and return a report" do
      pending "This test doesn't work, but the code actually does - tested by LAK"
      dirname = tmpdir("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

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