mirror of
https://github.com/nishiki/manage-password.git
synced 2025-03-20 21:34:35 +00:00
feat: alway use absolute path for wallet path
This commit is contained in:
parent
0195771c76
commit
8aeb7f5224
2 changed files with 4 additions and 4 deletions
|
@ -161,6 +161,7 @@ module MPW
|
||||||
# @param wallet [String] wallet name
|
# @param wallet [String] wallet name
|
||||||
def set_wallet_path(path, wallet)
|
def set_wallet_path(path, wallet)
|
||||||
path = @wallet_dir if path == 'default'
|
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_dir && File.exist?("#{@wallet_dir}/#{wallet}.mpw")
|
||||||
return if path == @wallet_paths[wallet]
|
return if path == @wallet_paths[wallet]
|
||||||
|
|
|
@ -142,7 +142,6 @@ class TestConfig < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_07_setup_wallet
|
def test_07_setup_wallet
|
||||||
path = '/tmp/'
|
|
||||||
gpg_key = 'test2@example.com'
|
gpg_key = 'test2@example.com'
|
||||||
|
|
||||||
output = %x(echo #{@password} | mpw wallet --add-gpg-key #{gpg_key})
|
output = %x(echo #{@password} | mpw wallet --add-gpg-key #{gpg_key})
|
||||||
|
@ -167,14 +166,14 @@ class TestConfig < Test::Unit::TestCase
|
||||||
puts output
|
puts output
|
||||||
assert_match('| default', output)
|
assert_match('| default', output)
|
||||||
|
|
||||||
output = %x(mpw wallet --path #{path})
|
output = %x(mpw wallet --path '.')
|
||||||
puts output
|
puts output
|
||||||
assert_match(I18n.t('form.set_wallet_path.valid'), output)
|
assert_match(I18n.t('form.set_wallet_path.valid'), output)
|
||||||
|
|
||||||
output = %x(mpw config)
|
output = %x(mpw config)
|
||||||
puts output
|
puts output
|
||||||
assert_match(%r{path_wallet_default.+\| #{path}/default.mpw}, output)
|
assert_match(%r{path_wallet_default.+\| #{Dir.pwd}/default.mpw}, output)
|
||||||
assert(File.exist?("#{path}/default.mpw"))
|
assert(File.exist?("#{Dir.pwd}/default.mpw"))
|
||||||
|
|
||||||
output = %x(mpw wallet --default-path)
|
output = %x(mpw wallet --default-path)
|
||||||
puts output
|
puts output
|
||||||
|
|
Loading…
Add table
Reference in a new issue