summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-24 12:17:52 -0600
committerLuke Kanies <luke@madstop.com>2008-11-24 12:17:52 -0600
commitb415848841edac9b08ff604416ad2e24dd350b4d (patch)
tree85d4a612720cbacc2efd4aad1db27afea22b4efe /spec/unit
parent9ed382d397c79995e850a91ac92e22106d670bed (diff)
downloadpuppet-b415848841edac9b08ff604416ad2e24dd350b4d.tar.gz
puppet-b415848841edac9b08ff604416ad2e24dd350b4d.tar.xz
puppet-b415848841edac9b08ff604416ad2e24dd350b4d.zip
Fixing #1708 - user groups specified as names are now detected correctly.
There was a bug when groups were specified by name -- the group was always compared to the current gid, rather than being converted to an integer and comparing that way. This is now fixed. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/type/user.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index 41b10da81..19690eee1 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -161,6 +161,26 @@ describe user do
gid.should.must == "foo"
end
+ describe "when testing whether in sync" do
+ before do
+ @gid = user.attrclass(:gid).new(:resource => @resource, :should => %w{foo bar})
+ end
+
+ it "should return true if any of the specified groups are equal to the current integer" do
+ Puppet::Util.expects(:gid).with("foo").returns 300
+ Puppet::Util.expects(:gid).with("bar").returns 500
+
+ @gid.must be_insync(500)
+ end
+
+ it "should return false if none of the specified groups are equal to the current integer" do
+ Puppet::Util.expects(:gid).with("foo").returns 300
+ Puppet::Util.expects(:gid).with("bar").returns 500
+
+ @gid.should_not be_insync(700)
+ end
+ end
+
describe "when syncing" do
before do
@gid = user.attrclass(:gid).new(:resource => @resource, :should => %w{foo bar})