From: Joel Rosario <[email protected]>

Signed-off-by: James Turnbull <[email protected]>
---
Local-branch: tickets/master/6693
 spec/integration/provider/user/useradd_win.rb |   41 +++++++++++++++++--------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/spec/integration/provider/user/useradd_win.rb 
b/spec/integration/provider/user/useradd_win.rb
index 97bc512..55cd094 100644
--- a/spec/integration/provider/user/useradd_win.rb
+++ b/spec/integration/provider/user/useradd_win.rb
@@ -38,19 +38,34 @@ describe "Provider for windows users" do
         expected_groups.length.should be_eql(groups.length)
     end
 
-    it 'should set the group membership of an existing user' do
-        expected_groups = ["randomgroup1", "randomgroup2"]
-        username = "testuser"
-
-        mkgroups expected_groups
-        mkuser username
-
-        provider = user_provider :name => username
-        provider.groups = expected_groups.join(",")
-
-        groups = provider.groups.split(',').collect {|group| group.strip }
-        groups.length.should be_eql(expected_groups.length)
-        groups.each {|group| expected_groups.include?(group).should be_true }
+    describe "when a user belongs to groups named randomgroup1, randomgroup2," 
do
+        before(:all) do
+            expected_groups = ["randomgroup1", "randomgroup2"]
+            username = "testuser"
+
+            mkgroups expected_groups
+            mkuser username
+
+            @provider = user_provider :name => username
+            @provider.groups = expected_groups.join(",")
+
+            groups = @provider.groups.split(',').collect {|group| group.strip }
+            groups.length.should be_eql(expected_groups.length)
+            groups.each {|group| expected_groups.include?(group).should 
be_true }
+        end
+        
+        describe "after setting membership to randomgroup1 only, " do
+            before(:all) do
+                @provider.groups = "randomgroup1"
+            end
+            
+            it "the user should no more be a member of randomgroup 2" do
+                groups = @provider.groups
+                
+                groups.index(',').should be_nil
+                groups.should be_eql("randomgroup1")
+            end
+        end
     end
 
     it 'should set a users password' do
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to