summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2011-04-14 02:05:10 +1000
committerJames Turnbull <james@lovedthanlost.net>2011-04-14 02:05:10 +1000
commit65c4e14621786e51c6eb3621098abbbadd7aa89d (patch)
tree564c0cd98b43661102391378a88858c9f82cdb7e /spec
parentda4457be4dedaed5368bacf81a08f0429e21cd45 (diff)
Fixed #7082 - Added system support for groups
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/provider/group/groupadd_spec.rb12
-rwxr-xr-xspec/unit/type/group_spec.rb9
2 files changed, 19 insertions, 2 deletions
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 33d9acd98..65cc887e4 100755
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -10,10 +10,10 @@ describe provider_class do
@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.stubs(:system?).returns true
@resource.expects(:allowdupe?).returns true
@provider.expects(:execute).with { |args| args.include?("-o") }
@@ -28,4 +28,14 @@ describe provider_class do
@provider.gid = 150
end
+
+ it "should add -r when system is enabled and the group is being created" do
+ @resource.stubs(:should).returns "fakeval"
+ @resource.stubs(:[]).returns "fakeval"
+ @resource.expects(:system?).returns true
+ @resource.stubs(:allowdupe?).returns true
+ @provider.expects(:execute).with { |args| args.include?("-r") }
+
+ @provider.create
+ end
end
diff --git a/spec/unit/type/group_spec.rb b/spec/unit/type/group_spec.rb
index b41ce71a0..e373dac6e 100755
--- a/spec/unit/type/group_spec.rb
+++ b/spec/unit/type/group_spec.rb
@@ -16,6 +16,10 @@ describe Puppet::Type.type(:group) 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
@@ -38,11 +42,14 @@ describe Puppet::Type.type(:group) do
end
end
- # #1407 - we need to declare the allowdupe param as boolean.
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)