1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-20 01:50:04 +00:00

feat: alway use absolute path for wallet path

This commit is contained in:
Adrien Waksberg 2017-08-12 01:19:52 +02:00
parent 0195771c76
commit 8aeb7f5224
2 changed files with 4 additions and 4 deletions

View file

@ -161,6 +161,7 @@ module MPW
# @param wallet [String] wallet name
def set_wallet_path(path, wallet)
path = @wallet_dir if path == 'default'
path = File.absolute_path(path)
return if path == @wallet_dir && File.exist?("#{@wallet_dir}/#{wallet}.mpw")
return if path == @wallet_paths[wallet]

View file

@ -142,7 +142,6 @@ class TestConfig < Test::Unit::TestCase
end
def test_07_setup_wallet
path = '/tmp/'
gpg_key = 'test2@example.com'
output = %x(echo #{@password} | mpw wallet --add-gpg-key #{gpg_key})
@ -167,14 +166,14 @@ class TestConfig < Test::Unit::TestCase
puts output
assert_match('| default', output)
output = %x(mpw wallet --path #{path})
output = %x(mpw wallet --path '.')
puts output
assert_match(I18n.t('form.set_wallet_path.valid'), output)
output = %x(mpw config)
puts output
assert_match(%r{path_wallet_default.+\| #{path}/default.mpw}, output)
assert(File.exist?("#{path}/default.mpw"))
assert_match(%r{path_wallet_default.+\| #{Dir.pwd}/default.mpw}, output)
assert(File.exist?("#{Dir.pwd}/default.mpw"))
output = %x(mpw wallet --default-path)
puts output