Skip to content

Commit 06855d4

Browse files
Merge branch 'master' into add-transaction-types
2 parents 70bed86 + c21865a commit 06855d4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/ofx/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(resource)
1717
end
1818

1919
case headers["VERSION"]
20-
when /102/ then
20+
when /100|102/ then
2121
@parser = OFX102.new(:headers => headers, :body => body)
2222
when /103/ then
2323
@parser = OFX103.new(:headers => headers, :body => body)

spec/ofx/ofx_parser_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
}.to raise_error(OFX::UnsupportedFileError)
4848
end
4949

50+
it "uses 102 parser to parse version 100 ofx files" do
51+
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
52+
53+
ofx = OFX::Parser::Base.new(ofx_2_example('100'))
54+
expect(ofx.parser).to eql 'ofx-102-parser'
55+
end
56+
5057
it "uses 211 parser to parse version 200 ofx files" do
5158
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
5259

@@ -61,6 +68,13 @@
6168
expect(ofx.parser).to eql 'ofx-211-parser'
6269
end
6370

71+
it "uses 211 parser to parse version 220 ofx files" do
72+
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
73+
74+
ofx = OFX::Parser::Base.new(ofx_2_example('220'))
75+
expect(ofx.parser).to eql 'ofx-211-parser'
76+
end
77+
6478
describe "headers" do
6579
it "has OFXHEADER" do
6680
expect(@ofx.headers["OFXHEADER"]).to eql "100"

0 commit comments

Comments
 (0)