Skip to content
Browse files

adding more RSpec tests

  • Loading branch information...
1 parent 3c68fab commit 8a689465dd8e99d0126190dc667a2d1447c20a9e @tilo committed Sep 30, 2013
Showing with 35 additions and 0 deletions.
  1. +2 −0 .rspec
  2. +5 −0 spec/fixtures/quoted.csv
  3. +4 −0 spec/fixtures/separator.csv
  4. +11 −0 spec/smarter_csv/column_separator_spec.rb
  5. +13 −0 spec/smarter_csv/quoted_spec.rb
View
2 .rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
View
5 spec/fixtures/quoted.csv
@@ -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
View
4 spec/fixtures/separator.csv
@@ -0,0 +1,4 @@
+Year;Make;Model;Length
+1997;Ford;E350;2,34
+2000;Mercury;Cougar;2,38
+2013;Tesla;Model S;4,97
View
11 spec/smarter_csv/column_separator_spec.rb
@@ -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
View
13 spec/smarter_csv/quoted_spec.rb
@@ -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.
Something went wrong with that request. Please try again.