summaryrefslogtreecommitdiffstats
path: root/spec/unit/type/group.rb
blob: fad7a0c484082cc46255eff48b0605df985f647d (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
39
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

describe Puppet::Type.type(:group) do
    before do
        unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin")
            ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin"
        end
        @class = Puppet::Type.type(:group)
    end

    it "should have a default provider" do
        @class.defaultprovider.should_not be_nil
    end

    it "should have a default provider inheriting from Puppet::Provider" do
        @class.defaultprovider.ancestors.should be_include(Puppet::Provider)
    end

    describe "when validating attributes" do
        [:name, :allowdupe].each do |param|
            it "should have a #{param} parameter" do
                @class.attrtype(param).should == :param
            end
        end

        [:ensure, :gid].each do |param|
            it "should have a #{param} property" do
                @class.attrtype(param).should == :property
            end
        end
    end

    # #1407 - we need to declare the allowdupe param as boolean.
    it "should have a boolean method for determining if duplicates are allowed" do
        @class.new(:name => "foo").methods.should be_include("allowdupe?")
    end
end