Sha256: 9a819ea88206825f3aebbf71da228312e22a945f2c49600e2e61173d89e08976

Contents?: true

Size: 1.6 KB

Versions: 15

Compression:

Stored size: 1.6 KB

Contents

#!/usr/bin/env rspec
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", :'fails_on_ruby_1.9.2' => true do
    @class.new(:name => "foo").methods.should be_include("allowdupe?")
  end

  it "should have a boolean method for determining if system groups are allowed", :'fails_on_ruby_1.9.2' => true 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

15 entries across 15 versions & 2 rubygems

Version Path
puppet-2.7.26 spec/unit/type/group_spec.rb
puppet-2.7.25 spec/unit/type/group_spec.rb
puppet-2.7.24 spec/unit/type/group_spec.rb
puppet-2.7.23 spec/unit/type/group_spec.rb
puppet-2.7.22 spec/unit/type/group_spec.rb
puppet-2.7.21 spec/unit/type/group_spec.rb
puppet-2.7.20 spec/unit/type/group_spec.rb
puppet-2.7.20.rc1 spec/unit/type/group_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/group_spec.rb
puppet-2.7.19 spec/unit/type/group_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/group_spec.rb
puppet-2.7.18 spec/unit/type/group_spec.rb
puppet-2.7.17 spec/unit/type/group_spec.rb
puppet-2.7.16 spec/unit/type/group_spec.rb
puppet-2.7.14 spec/unit/type/group_spec.rb