Half-finished csv command

This commit is contained in:
Andy Meneely
2014-11-26 00:13:45 -05:00
parent 6579c86719
commit f60e3721c8
6 changed files with 74 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
require 'spec_helper'
describe Squib::Deck do
context '#csv' do
# it 'loads basic csv data' do
# expect(Squib.csv(file: csv_file('basic.csv'))).to eq({
# 'h1' => [1, 3],
# 'h2' => [2, 4]
# })
# end
end
end
+3
View File
@@ -0,0 +1,3 @@
h1,h2
1,2
3,4
1 h1 h2
2 1 2
3 3 4
+4
View File
@@ -27,6 +27,10 @@ def sample_regression_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/samples/#{file}.txt"
end
def csv_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/csv/#{file}"
end
def overwrite_sample(sample_name, log)
# Use this to overwrite the regression with current state
File.open(sample_regression_file(sample_name), 'w+:UTF-8') do |f|