summaryrefslogtreecommitdiffstats
path: root/spec/unit/face/secret_agent_spec.rb
blob: a5ec01f27cbe3c110f95476c556857e1cc1c700c (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
#!/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
  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 = 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

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