Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ GEM
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.10)
method_source (1.1.0)
mini_portile2 (2.8.7)
mini_portile2 (2.8.9)
nenv (0.3.0)
nkf (0.2.0)
nokogiri (1.14.5)
mini_portile2 (~> 2.8.0)
nokogiri (1.15.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down
1 change: 0 additions & 1 deletion lib/ofx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
require 'ofx/errors'
require 'ofx/parser'
require 'ofx/parser/ofx102'
require 'ofx/parser/ofx103'
require 'ofx/parser/ofx211'
require 'ofx/foundation'
require 'ofx/balance'
Expand Down
4 changes: 1 addition & 3 deletions lib/ofx/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ def initialize(resource)
end

case headers["VERSION"]
when /100|102/ then
when /100|102|103/ then
@parser = OFX102.new(:headers => headers, :body => body)
when /103/ then
@parser = OFX103.new(:headers => headers, :body => body)
when /200|202|211|220/ then
@parser = OFX211.new(:headers => headers, :body => body)
else
Expand Down
7 changes: 0 additions & 7 deletions lib/ofx/parser/ofx103.rb

This file was deleted.

80 changes: 0 additions & 80 deletions spec/fixtures/v103.ofx

This file was deleted.

51 changes: 0 additions & 51 deletions spec/ofx/ofx103_spec.rb

This file was deleted.

35 changes: 22 additions & 13 deletions spec/ofx/ofx_parser_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
require "spec_helper"

describe OFX::Parser do
def ofx_example_to(version)
<<~OFX_CONTENT
<?xml version="1.0" encoding="US-ASCII"?>

<?OFX OFXHEADER="200" VERSION="#{version}" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>"

<OFX>
</OFX>
OFX_CONTENT
end

before do
@ofx = OFX::Parser::Base.new("spec/fixtures/sample.ofx")
end
Expand Down Expand Up @@ -50,28 +61,35 @@
it "uses 102 parser to parse version 100 ofx files" do
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')

ofx = OFX::Parser::Base.new(ofx_2_example('100'))
ofx = OFX::Parser::Base.new(ofx_example_to('100'))
expect(ofx.parser).to eql 'ofx-102-parser'
end

it "uses 102 parser to parse version 103 ofx files" do
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')

ofx = OFX::Parser::Base.new(ofx_example_to('103'))
expect(ofx.parser).to eql 'ofx-102-parser'
end

it "uses 211 parser to parse version 200 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')

ofx = OFX::Parser::Base.new(ofx_2_example('200'))
ofx = OFX::Parser::Base.new(ofx_example_to('200'))
expect(ofx.parser).to eql 'ofx-211-parser'
end

it "uses 211 parser to parse version 202 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')

ofx = OFX::Parser::Base.new(ofx_2_example('202'))
ofx = OFX::Parser::Base.new(ofx_example_to('202'))
expect(ofx.parser).to eql 'ofx-211-parser'
end

it "uses 211 parser to parse version 220 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')

ofx = OFX::Parser::Base.new(ofx_2_example('220'))
ofx = OFX::Parser::Base.new(ofx_example_to('220'))
expect(ofx.parser).to eql 'ofx-211-parser'
end

Expand Down Expand Up @@ -125,13 +143,4 @@
expect(@ofx.headers.size).to be(9)
end
end

def ofx_2_example(version)
<<-EndOfx
<?xml version="1.0" encoding="US-ASCII"?>
<?OFX OFXHEADER="200" VERSION="#{version}" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>"
<OFX>
</OFX>
EndOfx
end
end