Sha256: aa8bb8b33b98922bfa4b1733ceb65f099c8a628931c854f34399e5bad0b3660d
Contents?: true
Size: 993 Bytes
Versions: 1
Compression:
Stored size: 993 Bytes
Contents
require 'helper' require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'csv2json.rb') # this form is important for local development class TestCsv2json < Test::Unit::TestCase SEPS = {:comma => ',', :pipe => '|', :semicolon => ';'} should "parse some test files" do fixtures_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) Dir.chdir(fixtures_dir) do Dir.glob('*.csv') do |filename| filename_parts = File.basename(filename, ".csv").split('_') json_template = filename_parts[0] + '.json' File.open(filename, "r") do |input| output = StringIO.new() CSV2JSON.parse(input, output, nil, :col_sep => SEPS[filename_parts[1].to_sym] ) template = File.read(json_template) output.pos = 0 assert template == output.read end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csv2json-0.2.0 | test/test_csv2json.rb |