blob: c677c1d2e1768470264010f145fdd9070b160c53 (
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
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/node/facts'
describe Puppet::Node::Facts, " when indirecting" do
before do
@terminus = mock 'terminus'
Puppet::Indirector.terminus(:facts, Puppet[:fact_store].intern).stubs(:new).returns(@terminus)
# We have to clear the cache so that the facts ask for our terminus stub,
# instead of anything that might be cached.
Puppet::Indirector::Indirection.clear_cache
end
it "should redirect to the specified fact store for retrieval" do
@terminus.expects(:get).with(:my_facts)
Puppet::Node::Facts.get(:my_facts)
end
it "should redirect to the specified fact store for storage" do
@terminus.expects(:post).with(:my_facts)
Puppet::Node::Facts.post(:my_facts)
end
after do
mocha_verify
Puppet::Indirector::Indirection.clear_cache
end
end
describe Puppet::Node::Facts, " when storing and retrieving" do
it "should add metadata to the facts" do
facts = Puppet::Node::Facts.new("me", "one" => "two", "three" => "four")
facts.values[:_timestamp].should be_instance_of(Time)
end
end
|