summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/group/groupadd_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider/group/groupadd_spec.rb')
-rwxr-xr-xspec/unit/provider/group/groupadd_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
new file mode 100755
index 000000000..fb4b811cb
--- /dev/null
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../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