From b22fb8ed8a0d3ba940335d9016d36dd9743e4fa4 Mon Sep 17 00:00:00 2001 From: Jan van der Pas Date: Tue, 24 Dec 2013 22:18:38 +0100 Subject: [PATCH] Add specs for the Parser#sort_csv_file if the transaction belongs to others --- spec/factories/api_factory.rb | 4 ++++ spec/fixtures/test_transaction_1.csv | 1 + spec/lib/ovchipkaart/api_spec.rb | 2 +- spec/lib/ovchipkaart/parser_spec.rb | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/factories/api_factory.rb b/spec/factories/api_factory.rb index 22c0ca9..c52d56e 100644 --- a/spec/factories/api_factory.rb +++ b/spec/factories/api_factory.rb @@ -26,4 +26,8 @@ def self.additions def self.products [{:datum=>"10-12-2013", :checkin=>"8:00", :vertrek=>"", :checkuit=>"", :bestemming=>"", :bedrag=>"", :transactie=>"Product op kaart gezet", :klasse=>"2", :product=>"Altijd Voordeel (maandabonnement)", :opmerkingen=>""}] end + + def self.unclassified + [{:datum=>"9-12-2013", :checkin=>"7:00", :vertrek=>"", :checkuit=>"", :bestemming=>"", :bedrag=>"", :transactie=>"Foo", :klasse=>"", :product=>"", :opmerkingen=>""}] + end end diff --git a/spec/fixtures/test_transaction_1.csv b/spec/fixtures/test_transaction_1.csv index b2887ce..9b2bd61 100644 --- a/spec/fixtures/test_transaction_1.csv +++ b/spec/fixtures/test_transaction_1.csv @@ -11,3 +11,4 @@ "11-12-2013";"8:15";"Den Haag Laan van NOI";"";"";"-10,00";"Check-in";"";"";"" "11-12-2013";"8:10";"Leiden Centraal";"";"";"-10,00";"Check-in";"";"";"" "10-12-2013";"8:00";"";"";"";"";"Product op kaart gezet";"2";"Altijd Voordeel (maandabonnement)";"" +"9-12-2013";"7:00";"";"";"";"";"Foo";"";"";"" diff --git a/spec/lib/ovchipkaart/api_spec.rb b/spec/lib/ovchipkaart/api_spec.rb index 4cb3c0c..a1b6884 100644 --- a/spec/lib/ovchipkaart/api_spec.rb +++ b/spec/lib/ovchipkaart/api_spec.rb @@ -8,7 +8,7 @@ let(:forgotten_checkouts) { Factory.forgotten_checkouts } let(:additions) { Factory.additions } let(:products) { Factory.products } - let(:unclassified) { [] } + let(:unclassified) { Factory.unclassified } describe 'public API' do before { Ovchipkaart::Parser.any_instance.stub(:csv_file).and_return csv_file } diff --git a/spec/lib/ovchipkaart/parser_spec.rb b/spec/lib/ovchipkaart/parser_spec.rb index d4455ef..a27e79b 100644 --- a/spec/lib/ovchipkaart/parser_spec.rb +++ b/spec/lib/ovchipkaart/parser_spec.rb @@ -20,7 +20,7 @@ specify { expect(subject.check_ins.count).to eql 5 } specify { expect(subject.additions.count).to eql 1 } specify { expect(subject.products.count).to eql 1 } - specify { expect(subject.others.count).to eql 0 } + specify { expect(subject.others.count).to eql 1 } specify { expect(subject.forgotten_check_outs.count).to eql 1 } end