summaryrefslogtreecommitdiff
path: root/spec/ruby/library/etc/getlogin_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/etc/getlogin_spec.rb')
-rw-r--r--spec/ruby/library/etc/getlogin_spec.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/ruby/library/etc/getlogin_spec.rb b/spec/ruby/library/etc/getlogin_spec.rb
index ae52942a92..43e654bda6 100644
--- a/spec/ruby/library/etc/getlogin_spec.rb
+++ b/spec/ruby/library/etc/getlogin_spec.rb
@@ -11,9 +11,15 @@ describe "Etc.getlogin" do
# make Etc.getlogin to return nil if getlogin(3) returns NULL
envuser, ENV['USER'] = ENV['USER'], nil
if Etc.getlogin
- # Etc.getlogin returns the same result of logname(2)
- # if it returns non NULL
- Etc.getlogin.should == `id -un`.chomp
+ if ENV['TRAVIS'] and platform_is(:darwin)
+ # See https://travis-ci.org/ruby/spec/jobs/285967744
+ # and https://travis-ci.org/ruby/spec/jobs/285999602
+ Etc.getlogin.should be_an_instance_of(String)
+ else
+ # Etc.getlogin returns the same result of logname(2)
+ # if it returns non NULL
+ Etc.getlogin.should == `id -un`.chomp
+ end
else
# Etc.getlogin may return nil if the login name is not set
# because of chroot or sudo or something.