Add test and comment for PATH#existing.
This commit is contained in:
parent
1c7238e59b
commit
1be5eeec26
@ -59,6 +59,7 @@ class PATH
|
||||
|
||||
def existing
|
||||
existing_path = select(&File.method(:directory?))
|
||||
# return nil instead of empty PATH, to unset environment variables
|
||||
existing_path unless existing_path.empty?
|
||||
end
|
||||
|
||||
|
||||
@ -107,5 +107,9 @@ describe PATH do
|
||||
expect(path.existing.to_ary).to eq(["/path1"])
|
||||
expect(path.to_ary).to eq(["/path1", "/path2"])
|
||||
end
|
||||
|
||||
it "returns nil instead of an empty #{described_class}" do
|
||||
expect(described_class.new.existing).to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user