summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/group/groupadd_spec.rb
blob: 65cb14503c4020205eb570c664e57b36d850b9aa (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
#!/usr/bin/env ruby

require 'spec_helper'

provider_class = Puppet::Type.type(:group).provider(:groupadd)

describe provider_class do
  before do
    @resource = stub("resource", :name => "mygroup")
    @provider = provider_class.new(@resource)
  end

  # #1360
  it "should add -o when allowdupe is enabled and the group is being created" do
    @resource.stubs(:should).returns "fakeval"
    @resource.stubs(:[]).returns "fakeval"
    @resource.expects(:allowdupe?).returns true
    @provider.expects(:execute).with { |args| args.include?("-o") }

    @provider.create
  end

  it "should add -o when allowdupe is enabled and the gid is being modified" do
    @resource.stubs(:should).returns "fakeval"
    @resource.stubs(:[]).returns "fakeval"
    @resource.expects(:allowdupe?).returns true
    @provider.expects(:execute).with { |args| args.include?("-o") }

    @provider.gid = 150
  end
end