aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/ruby/library/etc/getgrgid_spec.rb6
-rw-r--r--spec/ruby/library/etc/struct_group_spec.rb6
2 files changed, 10 insertions, 2 deletions
diff --git a/spec/ruby/library/etc/getgrgid_spec.rb b/spec/ruby/library/etc/getgrgid_spec.rb
index b5e4132de8..ff07d49016 100644
--- a/spec/ruby/library/etc/getgrgid_spec.rb
+++ b/spec/ruby/library/etc/getgrgid_spec.rb
@@ -13,10 +13,14 @@ end
# TODO: verify these on non-windows, non-darwin OS
platform_is_not :windows do
+ grpname = IO.popen(%w'id -gn', err: IO::NULL, &:read)
+ next unless $?.success?
+ grpname.chomp!
+
describe "Etc.getgrgid" do
before :all do
@gid = `id -g`.strip.to_i
- @name = `id -gn`.strip
+ @name = grpname
end
it "returns a Etc::Group struct instance for the given user" do
diff --git a/spec/ruby/library/etc/struct_group_spec.rb b/spec/ruby/library/etc/struct_group_spec.rb
index 030692116a..0b50ff578f 100644
--- a/spec/ruby/library/etc/struct_group_spec.rb
+++ b/spec/ruby/library/etc/struct_group_spec.rb
@@ -3,12 +3,16 @@ require 'etc'
describe "Struct::Group" do
platform_is_not :windows do
+ grpname = IO.popen(%w'id -gn', err: IO::NULL, &:read)
+ next unless $?.success?
+ grpname.chomp!
+
before :all do
@g = Etc.getgrgid(`id -g`.strip.to_i)
end
it "returns group name" do
- @g.name.should == `id -gn`.strip
+ @g.name.should == grpname
end
it "returns group password" do