aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/process/groups_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-01 15:41:50 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-01 15:41:50 +0000
commit4d7b0b9112f2adf9e87ef75056f930bf7c1f3dc4 (patch)
tree8d712e18a619a9720d181d0d44e8cc2474ff31ee /spec/ruby/core/process/groups_spec.rb
parent821d9a2d30f2e0d3f9009dc001b4b49aaa63c66e (diff)
downloadruby-4d7b0b9112f2adf9e87ef75056f930bf7c1f3dc4.tar.gz
Update to ruby/spec@bacedc5
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/process/groups_spec.rb')
-rw-r--r--spec/ruby/core/process/groups_spec.rb34
1 files changed, 22 insertions, 12 deletions
diff --git a/spec/ruby/core/process/groups_spec.rb b/spec/ruby/core/process/groups_spec.rb
index 0669258bf3..2e12aa350c 100644
--- a/spec/ruby/core/process/groups_spec.rb
+++ b/spec/ruby/core/process/groups_spec.rb
@@ -10,17 +10,24 @@ describe "Process.groups" do
actual = (Process.groups - [gid]).sort
actual.should == expected
end
+ end
+end
- # NOTE: This is kind of sketchy.
- it "sets the list of gids of groups in the supplemental group access list" do
- groups = Process.groups
- if Process.uid == 0
+describe "Process.groups=" do
+ platform_is_not :windows do
+ as_superuser do
+ it "sets the list of gids of groups in the supplemental group access list" do
+ groups = Process.groups
Process.groups = []
Process.groups.should == []
Process.groups = groups
Process.groups.sort.should == groups.sort
- else
- platform_is :aix do
+ end
+ end
+
+ as_user do
+ platform_is :aix do
+ it "sets the list of gids of groups in the supplemental group access list" do
# setgroups() is not part of the POSIX standard,
# so its behavior varies from OS to OS. AIX allows a non-root
# process to set the supplementary group IDs, as long as
@@ -30,6 +37,7 @@ describe "Process.groups" do
# it should no longer be able to set any supplementary
# group IDs, even if it originally belonged to them.
# It should only be able to set its primary group ID.
+ groups = Process.groups
Process.groups = groups
Process.groups.sort.should == groups.sort
Process.groups = []
@@ -41,14 +49,16 @@ describe "Process.groups" do
lambda { Process.groups = supplementary }.should raise_error(Errno::EPERM)
end
end
- platform_is_not :aix do
- lambda { Process.groups = [] }.should raise_error(Errno::EPERM)
+ end
+
+ platform_is_not :aix do
+ it "raises Errno::EPERM" do
+ groups = Process.groups
+ lambda {
+ Process.groups = groups
+ }.should raise_error(Errno::EPERM)
end
end
end
end
end
-
-describe "Process.groups=" do
- it "needs to be reviewed for spec completeness"
-end