mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 07:33:05 +00:00
add export test
This commit is contained in:
parent
8bbddd1656
commit
2cc4ed75bd
1 changed files with 18 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
require_relative '../lib/MPW'
|
require_relative '../lib/MPW'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
require 'csv'
|
||||||
|
|
||||||
class TestMPW < Test::Unit::TestCase
|
class TestMPW < Test::Unit::TestCase
|
||||||
|
|
||||||
|
@ -112,4 +113,21 @@ class TestMPW < Test::Unit::TestCase
|
||||||
assert(@mpw.import('fixtures.yml'))
|
assert(@mpw.import('fixtures.yml'))
|
||||||
assert_equal(2, @mpw.search.length)
|
assert_equal(2, @mpw.search.length)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_export_yaml
|
||||||
|
assert(@mpw.import('fixtures.yml'))
|
||||||
|
assert_equal(2, @mpw.search.length)
|
||||||
|
assert(@mpw.export('export.yml', :yaml))
|
||||||
|
export = YAML::load_file('export.yml')
|
||||||
|
assert_equal(2, export.length)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_export_csv
|
||||||
|
assert(@mpw.import('fixtures.yml'))
|
||||||
|
assert_equal(2, @mpw.search.length)
|
||||||
|
assert(@mpw.export('export.yml', :csv))
|
||||||
|
export = CSV.parse(File.read('export.yml'), headers: true)
|
||||||
|
assert_equal(2, export.length)
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue