Sha256: 8ffad1711912c5d04035f1848e710a8e680847c9e35f49411dc805a1f95f0e6a

Contents?: true

Size: 1.81 KB

Versions: 22

Compression:

Stored size: 1.81 KB

Contents

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

describe Puppet::Type.type(:group) do
  before do
    @class = Puppet::Type.type(:group)
  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").must respond_to "allowdupe?"
  end

  it "should have a boolean method for determining if system groups are allowed" do
    @class.new(:name => "foo").must respond_to "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

  it "delegates the existance check to its provider" do
    provider = @class.provide(:testing) {}
    provider_instance = provider.new
    provider_instance.expects(:exists?).returns true

    type = @class.new(:name => "group", :provider => provider_instance)

    type.exists?.should == true
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
puppet-3.3.2 spec/unit/type/group_spec.rb
puppet-3.3.1 spec/unit/type/group_spec.rb
puppet-3.3.1.rc3 spec/unit/type/group_spec.rb
puppet-3.3.1.rc2 spec/unit/type/group_spec.rb
puppet-3.3.1.rc1 spec/unit/type/group_spec.rb
puppet-3.3.0 spec/unit/type/group_spec.rb
puppet-3.3.0.rc3 spec/unit/type/group_spec.rb
puppet-3.3.0.rc2 spec/unit/type/group_spec.rb
puppet-3.2.4 spec/unit/type/group_spec.rb
puppet-3.2.3 spec/unit/type/group_spec.rb
puppet-3.2.3.rc1 spec/unit/type/group_spec.rb
puppet-3.2.2 spec/unit/type/group_spec.rb
puppet-3.2.1 spec/unit/type/group_spec.rb
puppet-3.2.1.rc1 spec/unit/type/group_spec.rb
puppet-3.2.0.rc2 spec/unit/type/group_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/type/group_spec.rb
puppet-3.2.0.rc1 spec/unit/type/group_spec.rb
puppet-3.1.1 spec/unit/type/group_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/type/group_spec.rb
puppet-3.1.0 spec/unit/type/group_spec.rb