Sha256: 0dac969e6c0eec96b7de67692b4293bd146fb722deeddb4e5dd00dcfec185f3f

Contents?: true

Size: 1.93 KB

Versions: 11

Compression:

Stored size: 1.93 KB

Contents

#!/usr/bin/env ruby

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

describe Puppet::Type.type(:group) do
  before do
    ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin")
    @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

  it "should have a system_groups feature" do
    @class.provider_feature(:system_groups).should_not be_nil
  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

    it "should convert gids provided as strings into integers" do
      @class.new(:name => "foo", :gid => "15")[:gid].should == 15
    end

    it "should accepts gids provided as integers" do
      @class.new(:name => "foo", :gid => 15)[:gid].should == 15
    end
  end

  it "should have a boolean method for determining if duplicates are allowed" do
    @class.new(:name => "foo").methods.should be_include("allowdupe?")
  end

  it "should have a boolean method for determining if system groups are allowed" do
    @class.new(:name => "foo").methods.should be_include("system?")
  end

  it "should call 'create' to create the group" do
    group = @class.new(:name => "foo", :ensure => :present)
    group.provider.expects(:create)
    group.parameter(:ensure).sync
  end

  it "should call 'delete' to remove the group" do
    group = @class.new(:name => "foo", :ensure => :absent)
    group.provider.expects(:delete)
    group.parameter(:ensure).sync
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/unit/type/group_spec.rb
puppet-2.6.17 spec/unit/type/group_spec.rb
puppet-2.6.16 spec/unit/type/group_spec.rb
puppet-2.6.15 spec/unit/type/group_spec.rb
puppet-2.6.14 spec/unit/type/group_spec.rb
puppet-2.6.13 spec/unit/type/group_spec.rb
puppet-2.6.12 spec/unit/type/group_spec.rb
puppet-2.6.11 spec/unit/type/group_spec.rb
puppet-2.6.10 spec/unit/type/group_spec.rb
puppet-2.6.9 spec/unit/type/group_spec.rb
puppet-2.6.8 spec/unit/type/group_spec.rb