Sha256: a08195f60208374bb305407e7080d84a227d1d40cac9f15cb46ffdaaaf1a73c5
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 Bytes
Contents
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'csvstack2' require 'csv' require 'tmpdir' require 'shellwords' module SpecHelper def run(*args) out_path = File.join(Dir.tmpdir, "#{args.join('_').gsub(/\W/, '_')}-#{Time.now.to_f}.csv") bin_path = File.expand_path("../../bin/#{args.shift}", __FILE__) in_paths = args.map { |path| File.expand_path("../support/#{path}", __FILE__) } cmd = "bash -c 'bundle exec #{bin_path} #{in_paths.map { |path| Shellwords.escape(path) }.join(' ')}' > #{out_path}" stdout = `#{cmd}` unless $?.success? $stderr.puts "boom: #{cmd}" $stderr.puts stdout end out_path end def assert_csv(got_csv_path, expected_csv) got = CSV.read(got_csv_path, headers: true).to_s expected = CSV.parse(expected_csv.gsub(/^ */, '').strip, headers: true).to_s got.should == expected end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csvstack2-0.0.1 | spec/spec_helper.rb |