Sha256: 6e719a1c3361d5698c0accad2731c9c711a3d0434e7da51f5e9440e8e08f6919

Contents?: true

Size: 1.92 KB

Versions: 35

Compression:

Stored size: 1.92 KB

Contents

#!/usr/bin/env rspec
require 'spec_helper'

require 'puppet/external/nagios'

describe "Nagios resource types" do
  Nagios::Base.eachtype do |name, nagios_type|
    puppet_type = Puppet::Type.type("nagios_#{name}")

    it "should have a valid type for #{name}" do
      puppet_type.should_not be_nil
    end

    next unless puppet_type

    describe puppet_type do
      it "should be defined as a Puppet resource type" do
        puppet_type.should_not be_nil
      end

      it "should have documentation" do
        puppet_type.instance_variable_get("@doc").should_not == ""
      end

      it "should have #{nagios_type.namevar} as its key attribute" do
        puppet_type.key_attributes.should == [nagios_type.namevar]
      end

      it "should have documentation for its #{nagios_type.namevar} parameter" do
        puppet_type.attrclass(nagios_type.namevar).instance_variable_get("@doc").should_not be_nil
      end

      it "should have an ensure property" do
        puppet_type.should be_validproperty(:ensure)
      end

      it "should have a target property" do
        puppet_type.should be_validproperty(:target)
      end

      it "should have documentation for its target property" do
        puppet_type.attrclass(:target).instance_variable_get("@doc").should_not be_nil
      end

      nagios_type.parameters.reject { |param| param == nagios_type.namevar or param.to_s =~ /^[0-9]/ }.each do |param|
        it "should have a #{param} property" do
          puppet_type.should be_validproperty(param)
        end

        it "should have documentation for its #{param} property" do
          puppet_type.attrclass(param).instance_variable_get("@doc").should_not be_nil
        end
      end

      nagios_type.parameters.find_all { |param| param.to_s =~ /^[0-9]/ }.each do |param|
        it "should have not have a #{param} property" do
          puppet_type.should_not be_validproperty(:param)
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/type/nagios_spec.rb
puppet-2.7.25 spec/unit/type/nagios_spec.rb
puppet-2.7.24 spec/unit/type/nagios_spec.rb
puppet-2.7.23 spec/unit/type/nagios_spec.rb
puppet-2.7.22 spec/unit/type/nagios_spec.rb
puppet-2.7.21 spec/unit/type/nagios_spec.rb
puppet-2.7.20 spec/unit/type/nagios_spec.rb
puppet-2.7.20.rc1 spec/unit/type/nagios_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/nagios_spec.rb
puppet-2.7.19 spec/unit/type/nagios_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/nagios_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/nagios_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/nagios_spec.rb
puppet-2.7.18 spec/unit/type/nagios_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/nagios_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/nagios_spec.rb
puppet-2.7.17 spec/unit/type/nagios_spec.rb
puppet-2.7.16 spec/unit/type/nagios_spec.rb
puppet-2.7.14 spec/unit/type/nagios_spec.rb
puppet-2.7.13 spec/unit/type/nagios_spec.rb