summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/ruby/core/file/expand_path_spec.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/ruby/core/file/expand_path_spec.rb b/spec/ruby/core/file/expand_path_spec.rb
index b03bb3a2ca..c2899fe1ac 100644
--- a/spec/ruby/core/file/expand_path_spec.rb
+++ b/spec/ruby/core/file/expand_path_spec.rb
@@ -2,6 +2,7 @@
require_relative '../../spec_helper'
require_relative 'fixtures/common'
+require 'etc'
describe "File.expand_path" do
before :each do
@@ -222,14 +223,16 @@ platform_is_not :windows do
ENV["HOME"] = @home
end
- it "uses the user database when passed '~' if HOME is nil" do
- ENV.delete "HOME"
- File.directory?(File.expand_path("~")).should == true
- end
+ guard -> { Etc.getlogin } do
+ it "uses the user database when passed '~' if HOME is nil" do
+ ENV.delete "HOME"
+ File.directory?(File.expand_path("~")).should == true
+ end
- it "uses the user database when passed '~/' if HOME is nil" do
- ENV.delete "HOME"
- File.directory?(File.expand_path("~/")).should == true
+ it "uses the user database when passed '~/' if HOME is nil" do
+ ENV.delete "HOME"
+ File.directory?(File.expand_path("~/")).should == true
+ end
end
it "raises an ArgumentError when passed '~' if HOME == ''" do