1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-10-27 02:33:19 +00:00

add export test

This commit is contained in:
nishiki 2014-12-28 18:18:45 +01:00
parent 8bbddd1656
commit 2cc4ed75bd

View file

@ -3,6 +3,7 @@
require_relative '../lib/MPW'
require 'test/unit'
require 'yaml'
require 'csv'
class TestMPW < Test::Unit::TestCase
@ -112,4 +113,21 @@ class TestMPW < Test::Unit::TestCase
assert(@mpw.import('fixtures.yml'))
assert_equal(2, @mpw.search.length)
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