diff options
| author | Luke Kanies <luke@madstop.com> | 2007-09-12 15:32:25 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-09-12 15:32:25 -0500 |
| commit | a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c (patch) | |
| tree | 6b8dbf7f3f2779254174b0829412a5365ad6ebed /spec/unit/node/facts.rb | |
| parent | 1459c507ddccff2a2a6fbadd4c880c023b5e9893 (diff) | |
| download | puppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.tar.gz puppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.tar.xz puppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.zip | |
Another intermediate commit. The node and fact classes are now functional and are used instead of the network handlers, which have been removed. There are some failing tests as a result, but I want to get this code committed before I massage the rest of the system to make it work again.
Diffstat (limited to 'spec/unit/node/facts.rb')
| -rwxr-xr-x | spec/unit/node/facts.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/spec/unit/node/facts.rb b/spec/unit/node/facts.rb index c7fc65f38..c677c1d2e 100755 --- a/spec/unit/node/facts.rb +++ b/spec/unit/node/facts.rb @@ -6,11 +6,12 @@ require 'puppet/node/facts' describe Puppet::Node::Facts, " when indirecting" do before do - Puppet[:fact_store] = "test_store" - @terminus_class = mock 'terminus_class' @terminus = mock 'terminus' - @terminus_class.expects(:new).returns(@terminus) - Puppet::Indirector.expects(:terminus).with(:facts, :test_store).returns(@terminus_class) + 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 @@ -19,7 +20,19 @@ describe Puppet::Node::Facts, " when indirecting" do end it "should redirect to the specified fact store for storage" do - @terminus.expects(:put).with(:my_facts) - Puppet::Node::Facts.put(:my_facts) + @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 |
