diff options
| author | Luke Kanies <luke@madstop.com> | 2008-01-07 12:03:44 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-01-07 12:03:44 -0600 |
| commit | 117926c92c8bdf2a45724c0ae758586f5ae23979 (patch) | |
| tree | 1f19745ea4327eaa6836647a10612d491d090ed4 | |
| parent | a7bca7eb8471d546edc27d452cccb8a23ca9b801 (diff) | |
Fixing the unit tests for nagios_maker; I could swear I'd already
done this but I must not have committed it.
| -rw-r--r-- | lib/puppet/util/nagios_maker.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/util/nagios_maker.rb | 16 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/puppet/util/nagios_maker.rb b/lib/puppet/util/nagios_maker.rb index 88402838f..a7aae4e70 100644 --- a/lib/puppet/util/nagios_maker.rb +++ b/lib/puppet/util/nagios_maker.rb @@ -40,14 +40,15 @@ module Puppet::Util::NagiosMaker end end - provider = type.provide(:naginator, :parent => Puppet::Provider::Naginator, :default_target => "/etc/nagios/#{full_name.to_s}.cfg") {} + target = "/etc/nagios/#{full_name.to_s}.cfg" + provider = type.provide(:naginator, :parent => Puppet::Provider::Naginator, :default_target => target) {} type.desc "The Nagios type #{name.to_s}. This resource type is autogenerated using the model developed in Naginator_, and all of the Nagios types are generated using the same code and the same library. This type generates Nagios configuration statements in Nagios-parseable configuration - files. By default, the statements will be added to ``#{provider.default_target}``, but + files. By default, the statements will be added to ``#{target}``, but you can send them to a different file by setting their ``target`` attribute. .. _naginator: http://reductivelabs.com/trac/naginator diff --git a/spec/unit/util/nagios_maker.rb b/spec/unit/util/nagios_maker.rb index 0454b6503..b75439400 100755 --- a/spec/unit/util/nagios_maker.rb +++ b/spec/unit/util/nagios_maker.rb @@ -26,14 +26,14 @@ describe Puppet::Util::NagiosMaker do end it "should create a new RAL type with the provided name prefixed with 'nagios_'" do - type = stub 'type', :newparam => nil, :newproperty => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newparam => nil, :newproperty => nil, :ensurable => nil, :provide => nil, :desc => nil Puppet::Type.expects(:newtype).with(:nagios_test).returns(type) @module.create_nagios_type(:test) end it "should mark the created type as ensurable" do - type = stub 'type', :newparam => nil, :newproperty => nil, :provide => nil + type = stub 'type', :newparam => nil, :newproperty => nil, :provide => nil, :desc => nil type.expects(:ensurable) @@ -42,7 +42,7 @@ describe Puppet::Util::NagiosMaker do end it "should create a namevar parameter for the nagios type's name parameter" do - type = stub 'type', :newproperty => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newproperty => nil, :ensurable => nil, :provide => nil, :desc => nil type.expects(:newparam).with(:name, :namevar => true) @@ -51,7 +51,7 @@ describe Puppet::Util::NagiosMaker do end it "should create a property for all non-namevar parameters" do - type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil, :desc => nil @nagtype.stubs(:parameters).returns([:one, :two]) @@ -64,7 +64,7 @@ describe Puppet::Util::NagiosMaker do end it "should skip parameters that start with integers" do - type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil, :desc => nil @nagtype.stubs(:parameters).returns(["2dcoords".to_sym, :other]) @@ -76,7 +76,7 @@ describe Puppet::Util::NagiosMaker do end it "should deduplicate the parameter list" do - type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil, :desc => nil @nagtype.stubs(:parameters).returns([:one, :one]) @@ -88,7 +88,7 @@ describe Puppet::Util::NagiosMaker do end it "should create a target property" do - type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil + type = stub 'type', :newparam => nil, :ensurable => nil, :provide => nil, :desc => nil type.expects(:newproperty).with(:target) @@ -104,7 +104,7 @@ describe Puppet::Util::NagiosMaker, " when creating the naginator provider" do @nagtype = stub 'nagios type', :parameters => [], :namevar => :name Nagios::Base.stubs(:type).with(:test).returns(@nagtype) - @type = stub 'type', :newparam => nil, :ensurable => nil, :newproperty => nil + @type = stub 'type', :newparam => nil, :ensurable => nil, :newproperty => nil, :desc => nil Puppet::Type.stubs(:newtype).with(:nagios_test).returns(@type) end |
