ruby-changes:51492
From: nobu <ko1@a...>
Date: Wed, 20 Jun 2018 20:14:16 +0900 (JST)
Subject: [ruby-changes:51492] nobu:r63702 (trunk): skip when group name is not found
nobu 2018-06-20 20:14:08 +0900 (Wed, 20 Jun 2018) New Revision: 63702 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63702 Log: skip when group name is not found Modified files: trunk/spec/ruby/library/etc/getgrgid_spec.rb trunk/spec/ruby/library/etc/struct_group_spec.rb Index: spec/ruby/library/etc/getgrgid_spec.rb =================================================================== --- spec/ruby/library/etc/getgrgid_spec.rb (revision 63701) +++ spec/ruby/library/etc/getgrgid_spec.rb (revision 63702) @@ -13,10 +13,14 @@ end https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/etc/getgrgid_spec.rb#L13 # 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 Index: spec/ruby/library/etc/struct_group_spec.rb =================================================================== --- spec/ruby/library/etc/struct_group_spec.rb (revision 63701) +++ spec/ruby/library/etc/struct_group_spec.rb (revision 63702) @@ -3,12 +3,16 @@ require 'etc' https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/etc/struct_group_spec.rb#L3 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/