[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:04 UTC 2009


The following commit has been merged in the master branch:
commit 063871fab0b96111d16b6df19511e1034cc02a42
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Jan 6 16:14:20 2009 -0600

    Adding some basic tests for the Naginator provider base class
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/spec/unit/provider/naginator.rb b/spec/unit/provider/naginator.rb
new file mode 100644
index 0000000..c39a50c
--- /dev/null
+++ b/spec/unit/provider/naginator.rb
@@ -0,0 +1,50 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/provider/naginator'
+
+describe Puppet::Provider::Naginator do
+    before do
+        @resource_type = stub 'resource_type', :name => :nagios_test
+        @class = Class.new(Puppet::Provider::Naginator)
+
+        @class.stubs(:resource_type).returns @resource_type
+    end
+
+    it "should be able to look up the associated Nagios type" do
+        nagios_type = mock "nagios_type"
+        nagios_type.stubs :attr_accessor
+        Nagios::Base.expects(:type).with(:test).returns nagios_type
+
+        @class.nagios_type.should equal(nagios_type)
+    end
+
+    it "should use the Nagios type to determine whether an attribute is valid" do
+        nagios_type = mock "nagios_type"
+        nagios_type.stubs :attr_accessor
+        Nagios::Base.expects(:type).with(:test).returns nagios_type
+
+        nagios_type.expects(:parameters).returns [:foo, :bar]
+
+        @class.valid_attr?(:test, :foo).should be_true
+    end
+
+    it "should use Naginator to parse configuration snippets" do
+        parser = mock 'parser'
+        parser.expects(:parse).with("my text").returns "my instances"
+        Nagios::Parser.expects(:new).returns(parser)
+
+        @class.parse("my text").should == "my instances"
+    end
+
+    it "should join Nagios::Base records with '\\n' when asked to convert them to text" do
+        @class.expects(:header).returns "myheader\n"
+
+        @class.to_file([:one, :two]).should == "myheader\none\ntwo"
+    end
+
+    it "should be able to prefetch instance from configuration files" do
+        @class.should respond_to(:prefetch)
+    end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list