Skip to content

Commit

Permalink
adding more RSpec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tilo committed Sep 30, 2013
1 parent 3c68fab commit 8a68946
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
5 changes: 5 additions & 0 deletions spec/fixtures/quoted.csv
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
Year,Make,Model,Description,Price
1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""","",4900.00
1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00
1996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof, loaded",4799.00
4 changes: 4 additions & 0 deletions spec/fixtures/separator.csv
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,4 @@
Year;Make;Model;Length
1997;Ford;E350;2,34
2000;Mercury;Cougar;2,38
2013;Tesla;Model S;4,97
11 changes: 11 additions & 0 deletions spec/smarter_csv/column_separator_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

fixture_path = 'spec/fixtures'

describe 'be_able_to' do
it 'loads_file_with_different_column_separator' do
options = {:col_sep => ';'}
data = SmarterCSV.process("#{fixture_path}/separator.csv", options)
data.flatten.size.should == 3
end
end
13 changes: 13 additions & 0 deletions spec/smarter_csv/quoted_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

fixture_path = 'spec/fixtures'

describe 'be_able_to' do
it 'loads_file_with_quoted_fields' do
options = {}
data = SmarterCSV.process("#{fixture_path}/quoted.csv", options)
data.flatten.size.should == 4
data[1][:description].should be_nil
data[2][:description].should be_nil
end
end

0 comments on commit 8a68946

Please sign in to comment.