|
1 | 1 | require "spec_helper" |
2 | 2 |
|
3 | 3 | describe OFX::Parser do |
4 | | - def ofx_2_example(version) |
| 4 | + def ofx_example_to(version) |
5 | 5 | <<~OFX_CONTENT |
6 | 6 | <?xml version="1.0" encoding="US-ASCII"?> |
7 | 7 |
|
@@ -58,65 +58,50 @@ def ofx_2_example(version) |
58 | 58 | }.should raise_error(OFX::UnsupportedFileError) |
59 | 59 | end |
60 | 60 |
|
61 | | - it "uses 102 parser to parse version 100 ofx files" do |
| 61 | + it "should use 102 parser to parse version 100 ofx files" do |
62 | 62 | expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser') |
63 | 63 |
|
64 | | - ofx = OFX::Parser::Base.new(ofx_2_example('100')) |
| 64 | + ofx = OFX::Parser::Base.new(ofx_example_to('100')) |
65 | 65 | expect(ofx.parser).to eql 'ofx-102-parser' |
66 | 66 | end |
67 | 67 |
|
68 | | - it "uses 102 parser to parse version 100 ofx files" do |
| 68 | + it "should use 102 parser to parse version 102 ofx files" do |
69 | 69 | expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser') |
70 | 70 |
|
71 | | - ofx = OFX::Parser::Base.new(ofx_2_example('100')) |
| 71 | + ofx = OFX::Parser::Base.new(ofx_example_to('102')) |
72 | 72 | expect(ofx.parser).to eql 'ofx-102-parser' |
73 | 73 | end |
74 | 74 |
|
75 | | - it "uses 102 parser to parse version 103 ofx files" do |
| 75 | + it "should use 102 parser to parse version 103 ofx files" do |
76 | 76 | expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser') |
77 | 77 |
|
78 | | - ofx = OFX::Parser::Base.new(ofx_2_example('103')) |
| 78 | + ofx = OFX::Parser::Base.new(ofx_example_to('103')) |
79 | 79 | expect(ofx.parser).to eql 'ofx-102-parser' |
80 | 80 | end |
81 | 81 |
|
82 | | - it "uses 102 parser to parse version 100 ofx files" do |
83 | | - expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser') |
84 | | - |
85 | | - ofx = OFX::Parser::Base.new(ofx_2_example('100')) |
86 | | - expect(ofx.parser).to eql 'ofx-102-parser' |
87 | | - end |
88 | | - |
89 | | - it "uses 211 parser to parse version 200 ofx files" do |
| 82 | + it "should use 211 parser to parse version 200 ofx files" do |
90 | 83 | expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser') |
91 | 84 |
|
92 | | - ofx = OFX::Parser::Base.new(ofx_2_example('200')) |
| 85 | + ofx = OFX::Parser::Base.new(ofx_example_to('200')) |
93 | 86 | ofx.parser.should == 'ofx-211-parser' |
94 | 87 | end |
95 | 88 |
|
96 | | - it "should use 211 parser to parse version 202 ofx files" do |
| 89 | + it "should use 211 parser to parse version 211 ofx files" do |
97 | 90 | OFX::Parser::OFX211.stub(:new).and_return('ofx-211-parser') |
98 | | - ofx = OFX::Parser::Base.new(ofx_2_example('202')) |
| 91 | + ofx = OFX::Parser::Base.new(ofx_example_to('211')) |
99 | 92 | ofx.parser.should == 'ofx-211-parser' |
100 | 93 | end |
101 | 94 |
|
102 | | - it "uses 211 parser to parse version 220 ofx files" do |
103 | | - expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser') |
104 | | - |
105 | | - ofx = OFX::Parser::Base.new(ofx_2_example('220')) |
106 | | - expect(ofx.parser).to eql 'ofx-211-parser' |
107 | | - end |
108 | | - |
109 | | - it "uses 211 parser to parse version 220 ofx files" do |
110 | | - expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser') |
111 | | - |
112 | | - ofx = OFX::Parser::Base.new(ofx_2_example('220')) |
113 | | - expect(ofx.parser).to eql 'ofx-211-parser' |
| 95 | + it "should use 211 parser to parse version 202 ofx files" do |
| 96 | + OFX::Parser::OFX211.stub(:new).and_return('ofx-211-parser') |
| 97 | + ofx = OFX::Parser::Base.new(ofx_example_to('202')) |
| 98 | + ofx.parser.should == 'ofx-211-parser' |
114 | 99 | end |
115 | 100 |
|
116 | | - it "uses 211 parser to parse version 220 ofx files" do |
| 101 | + it "should use 211 parser to parse version 220 ofx files" do |
117 | 102 | expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser') |
118 | 103 |
|
119 | | - ofx = OFX::Parser::Base.new(ofx_2_example('220')) |
| 104 | + ofx = OFX::Parser::Base.new(ofx_example_to('220')) |
120 | 105 | expect(ofx.parser).to eql 'ofx-211-parser' |
121 | 106 | end |
122 | 107 |
|
|
0 commit comments