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