spec/classes/account_spec.rb in fabric-0.4.1 vs spec/classes/account_spec.rb in fabric-0.4.2
- old
+ new
@@ -27,25 +27,50 @@
@server.execute_command("sudo ls -la /home | grep #{@user.name}")
@server.output.should =~ /^drwxr-xr-x/
end
end
- describe "with a user in a group" do
+ describe "with", User do
before(:each) do
@account.add_user
- @user.groups.new(:name => TEST_GROUP)
- @server.execute_command("sudo /usr/sbin/groupadd #{TEST_GROUP}")
end
- after(:each) do
- @server.execute_command("sudo /usr/sbin/groupdel #{TEST_GROUP}")
- end
+ describe "with a primary group" do
+ before(:each) do
+ @user.groups.new(:name => TEST_GROUP)
+ @server.execute_command("sudo /usr/sbin/groupadd #{TEST_GROUP}")
+ end
- it "should add the user to that group" do
- @account.add_to_groups
+ after(:each) do
+ @server.execute_command("sudo /usr/sbin/groupdel #{TEST_GROUP}")
+ end
- @server.execute_command("groups #{@user.name}")
- @server.output.should =~ / ?#{TEST_GROUP} ?/
+ it "should add the user to that group only" do
+ @account.add_to_groups
+
+ @server.execute_command("groups #{@user.name}")
+ @server.output.should =~ / ?#{TEST_GROUP} ?/
+ @server.output.should_not =~ / ?#{TEST_SECONDARY_GROUP} ?/
+ end
+
+ describe "and a secondary group" do
+ before(:each) do
+ @user.groups.new(:name => TEST_SECONDARY_GROUP)
+ @server.execute_command("sudo /usr/sbin/groupadd #{TEST_SECONDARY_GROUP}")
+ end
+
+ after(:each) do
+ @server.execute_command("sudo /usr/sbin/groupdel #{TEST_SECONDARY_GROUP}")
+ end
+
+ it "should add the user to those groups" do
+ @account.add_to_groups
+
+ @server.execute_command("groups #{@user.name}")
+ @server.output.should =~ / ?#{TEST_GROUP} ?/
+ @server.output.should =~ / ?#{TEST_SECONDARY_GROUP} ?/
+ end
+ end
end
end
describe "with a user with an ssh key" do
before(:each) do
\ No newline at end of file