blob: 1b428ef205e2c07733c7902c17fbbe404a9c06a6 (
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
|
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'puppet/indirector/catalog/rest'
require 'tempfile'
describe Puppet::String[:configurer, '0.0.1'] do
describe "#synchronize" do
it "should retrieve and apply a catalog and return a report" do
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
|