mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #419 from jc00ke/master
Fixes non-absolute exception for File.expand_path
This commit is contained in:
commit
ddfe5d5b34
2 changed files with 8 additions and 0 deletions
|
@ -21,6 +21,8 @@ module Fog
|
|||
@credential_path ||= begin
|
||||
path = ENV["FOG_RC"] || (ENV['HOME'] && File.directory?(ENV['HOME']) && '~/.fog')
|
||||
File.expand_path(path) if path
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@ Shindo.tests do
|
|||
Fog.credentials_path
|
||||
}
|
||||
|
||||
returns(nil, 'File.expand_path raises because of non-absolute path') {
|
||||
ENV.delete('FOG_RC')
|
||||
ENV['HOME'] = '.'
|
||||
Fog.credentials_path
|
||||
}
|
||||
|
||||
returns(nil, 'returns nil when neither FOG_RC or HOME are set') {
|
||||
ENV.delete('HOME')
|
||||
ENV.delete('FOG_RC')
|
||||
|
|
Loading…
Add table
Reference in a new issue