Try to more accurately reflect MRI's logic in specs for finding the home if $HOME is unset
This commit is contained in:
parent
5b93321064
commit
0d227d1ce6
@ -223,7 +223,16 @@ platform_is_not :windows do
|
|||||||
ENV["HOME"] = @home
|
ENV["HOME"] = @home
|
||||||
end
|
end
|
||||||
|
|
||||||
guard -> { Etc.getlogin } do
|
guard -> {
|
||||||
|
# We need to check if getlogin(3) returns non-NULL,
|
||||||
|
# as MRI only checks getlogin(3) for expanding '~' if $HOME is not set.
|
||||||
|
user = ENV.delete("USER")
|
||||||
|
begin
|
||||||
|
Etc.getlogin != nil
|
||||||
|
ensure
|
||||||
|
ENV["USER"] = user
|
||||||
|
end
|
||||||
|
} do
|
||||||
it "uses the user database when passed '~' if HOME is nil" do
|
it "uses the user database when passed '~' if HOME is nil" do
|
||||||
ENV.delete "HOME"
|
ENV.delete "HOME"
|
||||||
File.directory?(File.expand_path("~")).should == true
|
File.directory?(File.expand_path("~")).should == true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user