From d3404301bd038698879271a9d6366a6a5d8d7323 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Tue, 6 Aug 2013 19:48:57 -0700 Subject: [PATCH] Add regression spec for #37 Apparently #parse is pretty weird in that it includes the header row in the result, as a hash with header keys and values. --- TODO | 5 +++-- spec/lib/roo/csv_spec.rb | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index d55c6419..990ec9af 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,3 @@ -- replace builder gem with Nokogiri:Builder -- New parameter at #new specifying the name of the directory for the roo temporary files +- New parameter at #new specifying the name of the directory for the roo temporary files? +- Current #parse(headers: true)'s first entry is a hash of the header row as both + keys and values. :-P diff --git a/spec/lib/roo/csv_spec.rb b/spec/lib/roo/csv_spec.rb index 83f23c56..db3a411e 100644 --- a/spec/lib/roo/csv_spec.rb +++ b/spec/lib/roo/csv_spec.rb @@ -3,6 +3,19 @@ describe Roo::Csv do let(:path) { 'test/files/csvtypes.csv' } + describe '#parse' do + subject { + Roo::Csv.new(path).parse(options) + } + context 'with headers: true' do + let(:options) { {headers: true} } + + it "doesn't blow up" do + expect { subject }.to_not raise_error + end + end + end + describe '#csv_options' do context 'when created with the csv_options option' do let(:options) {