boleto_bancario 0.0.1.beta → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -2
- data/.travis.yml +10 -0
- data/Changelog.markdown +4 -0
- data/Gemfile +1 -1
- data/Planning.markdown +18 -86
- data/README.markdown +107 -55
- data/Rakefile +7 -1
- data/TODO.markdown +15 -1
- data/boleto_bancario.gemspec +7 -3
- data/lib/boleto_bancario.rb +27 -15
- data/lib/boleto_bancario/calculos/modulo11_fator_de9a2.rb +65 -0
- data/lib/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x.rb +5 -51
- data/lib/boleto_bancario/calculos/modulo_numero_de_controle.rb +117 -0
- data/lib/boleto_bancario/core/banco_brasil.rb +30 -5
- data/lib/boleto_bancario/core/banrisul.rb +182 -0
- data/lib/boleto_bancario/core/boleto.rb +67 -34
- data/lib/boleto_bancario/core/bradesco.rb +28 -16
- data/lib/boleto_bancario/core/caixa.rb +233 -0
- data/lib/boleto_bancario/core/hsbc.rb +170 -0
- data/lib/boleto_bancario/core/itau.rb +20 -10
- data/lib/boleto_bancario/core/real.rb +177 -0
- data/lib/boleto_bancario/core/santander.rb +19 -22
- data/lib/boleto_bancario/core/sicoob.rb +172 -0
- data/lib/boleto_bancario/core/sicredi.rb +290 -0
- data/lib/boleto_bancario/version.rb +1 -2
- data/spec/boleto_bancario/calculos/modulo10_spec.rb +4 -0
- data/spec/boleto_bancario/calculos/modulo11_fator_de2a9_spec.rb +6 -0
- data/spec/boleto_bancario/calculos/modulo11_fator_de9a2_spec.rb +31 -0
- data/spec/boleto_bancario/calculos/modulo_numero_de_controle_spec.rb +37 -0
- data/spec/boleto_bancario/core/banco_brasil_spec.rb +59 -65
- data/spec/boleto_bancario/core/banrisul_spec.rb +129 -0
- data/spec/boleto_bancario/core/boleto_spec.rb +148 -32
- data/spec/boleto_bancario/core/bradesco_spec.rb +29 -36
- data/spec/boleto_bancario/core/caixa_spec.rb +111 -0
- data/spec/boleto_bancario/core/hsbc_spec.rb +72 -0
- data/spec/boleto_bancario/core/itau_spec.rb +33 -36
- data/spec/boleto_bancario/core/real_spec.rb +104 -0
- data/spec/boleto_bancario/core/santander_spec.rb +26 -24
- data/spec/boleto_bancario/core/sicoob_spec.rb +111 -0
- data/spec/boleto_bancario/core/sicredi_spec.rb +149 -0
- data/spec/inheritance/banco_brasil_spec.rb +22 -0
- data/spec/inheritance/banrisul_spec.rb +22 -0
- data/spec/inheritance/boleto_spec.rb +15 -0
- data/spec/inheritance/bradesco_spec.rb +22 -0
- data/spec/inheritance/caixa_spec.rb +22 -0
- data/spec/inheritance/hsbc_spec.rb +22 -0
- data/spec/inheritance/itau_spec.rb +22 -0
- data/spec/inheritance/real_spec.rb +22 -0
- data/spec/inheritance/santander_spec.rb +22 -0
- data/spec/inheritance/sicoob_spec.rb +22 -0
- data/spec/inheritance/sicredi_spec.rb +22 -0
- data/spec/shared_examples/boleto_bancario_shared_example.rb +21 -34
- data/spec/spec_helper.rb +2 -2
- metadata +119 -47
- data/.rvmrc +0 -1
@@ -9,6 +9,10 @@ module BoletoBancario
|
|
9
9
|
Modulo10.new('7123457000').should eq '1'
|
10
10
|
end
|
11
11
|
|
12
|
+
it "should accept the example from Banrisul" do
|
13
|
+
Modulo10.new('00009274').should eq '2'
|
14
|
+
end
|
15
|
+
|
12
16
|
it "returns zero when number is 0" do
|
13
17
|
Modulo10.new('0').should eq '0'
|
14
18
|
end
|
@@ -27,6 +27,12 @@ module BoletoBancario
|
|
27
27
|
it { should eq '1' }
|
28
28
|
end
|
29
29
|
|
30
|
+
context 'with Banrisul example' do
|
31
|
+
subject { Modulo11FatorDe2a9.new('0419100100000550002110000000012283256304168') }
|
32
|
+
|
33
|
+
it { should eq '1' }
|
34
|
+
end
|
35
|
+
|
30
36
|
context 'when calculations returns 11' do
|
31
37
|
subject { Modulo11FatorDe2a9.new('1049107400000160000001100128701000901200298') }
|
32
38
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BoletoBancario
|
4
|
+
module Calculos
|
5
|
+
describe Modulo11FatorDe9a2 do
|
6
|
+
context "when the mod result is 10 (ten)" do
|
7
|
+
subject { Modulo11FatorDe9a2.new('3973') }
|
8
|
+
|
9
|
+
it { should eq '10' }
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when the mod result is zero" do
|
13
|
+
subject { Modulo11FatorDe9a2.new('3995') }
|
14
|
+
|
15
|
+
it { should eq '0' }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the result is one" do
|
19
|
+
subject { Modulo11FatorDe9a2.new('5964') }
|
20
|
+
|
21
|
+
it { should eq '1' }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "with a five digit number" do
|
25
|
+
subject { Modulo11FatorDe9a2.new('10949') }
|
26
|
+
|
27
|
+
it { should eq '5' }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BoletoBancario
|
4
|
+
module Calculos
|
5
|
+
describe ModuloNumeroDeControle do
|
6
|
+
context "when is simple calculation" do
|
7
|
+
subject { ModuloNumeroDeControle.new('00009274') }
|
8
|
+
|
9
|
+
it { should eq '22' }
|
10
|
+
end
|
11
|
+
|
12
|
+
context "another example" do
|
13
|
+
subject { ModuloNumeroDeControle.new('0000001') }
|
14
|
+
|
15
|
+
it { should eq '83' }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "example with second digit invalid" do
|
19
|
+
subject { ModuloNumeroDeControle.new('00009194') }
|
20
|
+
|
21
|
+
it { should eq '38' }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "example with second digit invalid and first digit with '9'" do
|
25
|
+
subject { ModuloNumeroDeControle.new('411') }
|
26
|
+
|
27
|
+
it { should eq '06' }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'should calculate when the first digit is not 10 (ten)' do
|
31
|
+
subject { ModuloNumeroDeControle.new('5') }
|
32
|
+
|
33
|
+
it { should eq '90' }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -12,26 +12,26 @@ module BoletoBancario
|
|
12
12
|
it { should_not have_valid(:agencia).when('12345', '123456', nil, '') }
|
13
13
|
end
|
14
14
|
|
15
|
-
context "#digito_agencia" do
|
16
|
-
it { should have_valid(:digito_agencia).when('1', '3', 'X') }
|
17
|
-
it { should_not have_valid(:digito_agencia).when('12', nil, '') }
|
18
|
-
end
|
19
|
-
|
20
15
|
context "#conta_corrente" do
|
21
16
|
it { should have_valid(:conta_corrente).when('12345678', '12345', '1234') }
|
22
17
|
it { should_not have_valid(:conta_corrente).when('123456789', nil, '') }
|
23
18
|
end
|
24
19
|
|
25
|
-
context "#digito_conta_corrente" do
|
26
|
-
it { should have_valid(:digito_conta_corrente).when('1') }
|
27
|
-
it { should_not have_valid(:digito_conta_corrente).when('12', nil, '') }
|
28
|
-
end
|
29
|
-
|
30
20
|
context "#codigo_cedente" do
|
31
21
|
it { should have_valid(:codigo_cedente).when('1234', '123456', '1234567', '12345678') }
|
32
22
|
it { should_not have_valid(:codigo_cedente).when('123', '1', '12', nil, '') }
|
33
23
|
end
|
34
24
|
|
25
|
+
context "#carteira" do
|
26
|
+
it { should have_valid(:carteira).when('12', '16', '17', '18', 12, 18) }
|
27
|
+
it { should_not have_valid(:carteira).when(nil, '', '5', '20', '100', 14, 19) }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#valor_documento" do
|
31
|
+
it { should have_valid(:valor_documento).when(1, 1.99, 100.99, 99_999_999.99, '100.99') }
|
32
|
+
it { should_not have_valid(:valor_documento).when(nil, '', '100,99', 100_000_000.99) }
|
33
|
+
end
|
34
|
+
|
35
35
|
context "when 'carteira' is 16 and 'codigo_cedente' 6 digits" do
|
36
36
|
subject { BancoBrasil.new(carteira: 16, codigo_cedente: 123456) }
|
37
37
|
|
@@ -73,19 +73,26 @@ module BoletoBancario
|
|
73
73
|
it { should have_valid(:numero_documento).when('123456789', '1235', '1234567') }
|
74
74
|
it { should_not have_valid(:numero_documento).when(nil, '', '1234567890', '12345678911234567') }
|
75
75
|
end
|
76
|
+
|
77
|
+
context "when 'codigo_cedente' unsupported" do
|
78
|
+
subject { BancoBrasil.new(codigo_cedente: 12345) }
|
79
|
+
|
80
|
+
it { should have_valid(:numero_documento).when('123456789', '1235', '1234567', '1234567890', '12345678911234567') }
|
81
|
+
it { should_not have_valid(:numero_documento).when(nil, '') }
|
82
|
+
end
|
76
83
|
end
|
77
84
|
|
78
85
|
describe "#agencia" do
|
79
86
|
context "when have a value" do
|
80
87
|
subject { BancoBrasil.new(:agencia => '001') }
|
81
88
|
|
82
|
-
|
89
|
+
it { expect(subject.agencia).to eq '0001' }
|
83
90
|
end
|
84
91
|
|
85
92
|
context "when is nil" do
|
86
93
|
subject { BancoBrasil.new(:agencia => nil) }
|
87
94
|
|
88
|
-
|
95
|
+
it { expect(subject.agencia).to be nil }
|
89
96
|
end
|
90
97
|
end
|
91
98
|
|
@@ -93,13 +100,13 @@ module BoletoBancario
|
|
93
100
|
context "when have a value" do
|
94
101
|
subject { BancoBrasil.new(:conta_corrente => 913) }
|
95
102
|
|
96
|
-
|
103
|
+
it { expect(subject.conta_corrente).to eq '00000913' }
|
97
104
|
end
|
98
105
|
|
99
106
|
context "when is nil" do
|
100
107
|
subject { BancoBrasil.new(:conta_corrente => nil) }
|
101
108
|
|
102
|
-
|
109
|
+
it { expect(subject.codigo_cedente).to be nil }
|
103
110
|
end
|
104
111
|
end
|
105
112
|
|
@@ -107,77 +114,77 @@ module BoletoBancario
|
|
107
114
|
context "when have 'codigo_cedente' 4 digits" do
|
108
115
|
subject { BancoBrasil.new(:numero_documento => 913, :codigo_cedente => 1234) }
|
109
116
|
|
110
|
-
|
117
|
+
it { expect(subject.numero_documento).to eq '0000913' }
|
111
118
|
end
|
112
119
|
|
113
120
|
context "when have 'codigo_cedente' 6 digits" do
|
114
121
|
subject { BancoBrasil.new(:numero_documento => 913, :codigo_cedente => 123456) }
|
115
122
|
|
116
|
-
|
123
|
+
it { expect(subject.numero_documento).to eq '00913' }
|
117
124
|
end
|
118
125
|
|
119
126
|
context "when have 'codigo_cedente' 7 digits" do
|
120
127
|
subject { BancoBrasil.new(:numero_documento => 913, :codigo_cedente => 1234567) }
|
121
128
|
|
122
|
-
|
129
|
+
it { expect(subject.numero_documento).to eq '0000000913' }
|
123
130
|
end
|
124
131
|
|
125
132
|
context "when have 'codigo_cedente' 8 digits" do
|
126
133
|
subject { BancoBrasil.new(:numero_documento => 913, :codigo_cedente => 12345678) }
|
127
134
|
|
128
|
-
|
135
|
+
it { expect(subject.numero_documento).to eq '000000913' }
|
129
136
|
end
|
130
137
|
|
131
138
|
context "when is nil" do
|
132
139
|
subject { BancoBrasil.new(:numero_documento => nil) }
|
133
140
|
|
134
|
-
|
141
|
+
it { expect(subject.numero_documento).to be nil }
|
135
142
|
end
|
136
143
|
|
137
144
|
context "when 'codigo_cedente' is nil" do
|
138
145
|
subject { BancoBrasil.new(:numero_documento => '12') }
|
139
146
|
|
140
|
-
|
147
|
+
it { expect(subject.numero_documento).to eq '12' }
|
141
148
|
end
|
142
149
|
end
|
143
150
|
|
144
151
|
describe "#codigo_banco" do
|
145
|
-
|
152
|
+
it { expect(subject.codigo_banco).to eq '001' }
|
146
153
|
end
|
147
154
|
|
148
155
|
describe "#digito_codigo_banco" do
|
149
|
-
|
156
|
+
it { expect(subject.digito_codigo_banco).to eq '9' }
|
150
157
|
end
|
151
158
|
|
152
159
|
describe "#agencia_codigo_cedente" do
|
153
|
-
subject { BancoBrasil.new(agencia: 9999,
|
160
|
+
subject { BancoBrasil.new(agencia: 9999, conta_corrente: 99999) }
|
154
161
|
|
155
|
-
|
162
|
+
it { expect(subject.agencia_codigo_cedente).to eq '9999-6 / 00099999-7' }
|
156
163
|
end
|
157
164
|
|
158
165
|
describe "#nosso_numero" do
|
159
166
|
context "when 'codigo_cedente 4 digits" do
|
160
167
|
subject { BancoBrasil.new(codigo_cedente: 1234, numero_documento: 1984) }
|
161
168
|
|
162
|
-
|
169
|
+
it { expect(subject.nosso_numero).to eq '12340001984-7' }
|
163
170
|
end
|
164
171
|
|
165
172
|
context "when 'codigo_cedente 6 digits" do
|
166
173
|
subject { BancoBrasil.new(codigo_cedente: 123456, numero_documento: 1984) }
|
167
174
|
|
168
|
-
|
175
|
+
it { expect(subject.nosso_numero).to eq '12345601984-2' }
|
169
176
|
end
|
170
177
|
|
171
178
|
context "when 'codigo_cedente 7 digits" do
|
172
179
|
subject { BancoBrasil.new(codigo_cedente: 1234567, numero_documento: 1984) }
|
173
180
|
|
174
|
-
|
181
|
+
it { expect(subject.nosso_numero).to eq '12345670000001984' }
|
175
182
|
end
|
176
183
|
|
177
184
|
context "when 'codigo_cedente 8 digits" do
|
178
185
|
subject { BancoBrasil.new(codigo_cedente: 12345678, numero_documento: 1984) }
|
179
186
|
|
180
|
-
|
187
|
+
it { expect(subject.nosso_numero).to eq '12345678000001984' }
|
181
188
|
end
|
182
189
|
end
|
183
190
|
|
@@ -185,13 +192,13 @@ module BoletoBancario
|
|
185
192
|
context "when is true" do
|
186
193
|
subject { BancoBrasil.new(codigo_cedente: 1234) }
|
187
194
|
|
188
|
-
|
195
|
+
it { expect(subject.codigo_cedente_quatro_digitos?).to be true }
|
189
196
|
end
|
190
197
|
|
191
198
|
context "when is false" do
|
192
199
|
subject { BancoBrasil.new(codigo_cedente: 12345) }
|
193
200
|
|
194
|
-
|
201
|
+
it { expect(subject.codigo_cedente_quatro_digitos?).to be false }
|
195
202
|
end
|
196
203
|
end
|
197
204
|
|
@@ -199,13 +206,13 @@ module BoletoBancario
|
|
199
206
|
context "when is true" do
|
200
207
|
subject { BancoBrasil.new(codigo_cedente: 123456) }
|
201
208
|
|
202
|
-
|
209
|
+
it { expect(subject.codigo_cedente_seis_digitos?).to be true }
|
203
210
|
end
|
204
211
|
|
205
212
|
context "when is false" do
|
206
213
|
subject { BancoBrasil.new(codigo_cedente: 1234567) }
|
207
214
|
|
208
|
-
|
215
|
+
it { expect(subject.codigo_cedente_seis_digitos?).to be false }
|
209
216
|
end
|
210
217
|
end
|
211
218
|
|
@@ -213,13 +220,13 @@ module BoletoBancario
|
|
213
220
|
context "when is true" do
|
214
221
|
subject { BancoBrasil.new(codigo_cedente: 1234567) }
|
215
222
|
|
216
|
-
|
223
|
+
it { expect(subject.codigo_cedente_sete_digitos?).to be true }
|
217
224
|
end
|
218
225
|
|
219
226
|
context "when is false" do
|
220
227
|
subject { BancoBrasil.new(codigo_cedente: 12345678) }
|
221
228
|
|
222
|
-
|
229
|
+
it { expect(subject.codigo_cedente_sete_digitos?).to be false }
|
223
230
|
end
|
224
231
|
end
|
225
232
|
|
@@ -227,13 +234,13 @@ module BoletoBancario
|
|
227
234
|
context "when is true" do
|
228
235
|
subject { BancoBrasil.new(codigo_cedente: 12345678) }
|
229
236
|
|
230
|
-
|
237
|
+
it { expect(subject.codigo_cedente_oito_digitos?).to be true }
|
231
238
|
end
|
232
239
|
|
233
240
|
context "when is false" do
|
234
241
|
subject { BancoBrasil.new(codigo_cedente: 123456789) }
|
235
242
|
|
236
|
-
|
243
|
+
it { expect(subject.codigo_cedente_oito_digitos?).to be false }
|
237
244
|
end
|
238
245
|
end
|
239
246
|
|
@@ -241,25 +248,25 @@ module BoletoBancario
|
|
241
248
|
context "when 'carteira' 18, 'numero_documento' 17 digits and 'codigo_cedente' 6 digits" do
|
242
249
|
subject { BancoBrasil.new(numero_documento: 12345678911234567, carteira: 18, codigo_cedente: 123456) }
|
243
250
|
|
244
|
-
|
251
|
+
it { expect(subject.nosso_numero_dezessete_posicoes?).to be true }
|
245
252
|
end
|
246
253
|
|
247
254
|
context "when 'carteira' 16, 'numero_documento' 17 digits and 'codigo_cedente' 6 digits" do
|
248
255
|
subject { BancoBrasil.new(numero_documento: 12345678911234567, carteira: 16, codigo_cedente: 123456) }
|
249
256
|
|
250
|
-
|
257
|
+
it { expect(subject.nosso_numero_dezessete_posicoes?).to be true }
|
251
258
|
end
|
252
259
|
|
253
260
|
context "when is 'carteira' is not supported" do
|
254
261
|
subject { BancoBrasil.new(numero_documento: 123456789, carteira: 12, codigo_cedente: 123456) }
|
255
262
|
|
256
|
-
|
263
|
+
it { expect(subject.nosso_numero_dezessete_posicoes?).to be false }
|
257
264
|
end
|
258
265
|
|
259
266
|
context "when is 'codigo_cedente' is not supported" do
|
260
267
|
subject { BancoBrasil.new(numero_documento: 123456789, carteira: 16, codigo_cedente: 1234567) }
|
261
268
|
|
262
|
-
|
269
|
+
it { expect(subject.nosso_numero_dezessete_posicoes?).to be false }
|
263
270
|
end
|
264
271
|
end
|
265
272
|
|
@@ -271,16 +278,14 @@ module BoletoBancario
|
|
271
278
|
banco_brasil.valor_documento = 2952.95
|
272
279
|
banco_brasil.numero_documento = 90801
|
273
280
|
banco_brasil.agencia = 7123
|
274
|
-
banco_brasil.digito_agencia = 6
|
275
281
|
banco_brasil.conta_corrente = 19345
|
276
|
-
banco_brasil.digito_conta_corrente = 7
|
277
282
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
278
283
|
banco_brasil.codigo_cedente = 4321
|
279
284
|
end
|
280
285
|
end
|
281
286
|
|
282
|
-
|
283
|
-
|
287
|
+
it { expect(subject.codigo_de_barras).to eq '00193556100002952954321009080171230001934518' }
|
288
|
+
it { expect(subject.linha_digitavel).to eq '00194.32103 09080.171235 00019.345180 3 55610000295295' }
|
284
289
|
end
|
285
290
|
|
286
291
|
context "'codigo_cedente' with 6 digits" do
|
@@ -290,16 +295,14 @@ module BoletoBancario
|
|
290
295
|
banco_brasil.valor_documento = 14001.99
|
291
296
|
banco_brasil.numero_documento = 12901
|
292
297
|
banco_brasil.agencia = 5030
|
293
|
-
banco_brasil.digito_agencia = 6
|
294
298
|
banco_brasil.conta_corrente = 14204195
|
295
|
-
banco_brasil.digito_conta_corrente = 7
|
296
299
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
297
300
|
banco_brasil.codigo_cedente = 555444
|
298
301
|
end
|
299
302
|
end
|
300
303
|
|
301
|
-
|
302
|
-
|
304
|
+
it { expect(subject.codigo_de_barras).to eq '00197556100014001995554441290150301420419518' }
|
305
|
+
it { expect(subject.linha_digitavel).to eq '00195.55440 41290.150303 14204.195185 7 55610001400199' }
|
303
306
|
end
|
304
307
|
|
305
308
|
context "'codigo_cedente' with 6 digits and 'nosso numero' with 17 digits" do
|
@@ -309,18 +312,15 @@ module BoletoBancario
|
|
309
312
|
banco_brasil.valor_documento = 14001.99
|
310
313
|
banco_brasil.numero_documento = 12345678911234567
|
311
314
|
banco_brasil.agencia = 5030
|
312
|
-
banco_brasil.digito_agencia = 6
|
313
315
|
banco_brasil.conta_corrente = 14204195
|
314
|
-
banco_brasil.digito_conta_corrente = 7
|
315
316
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
316
317
|
banco_brasil.codigo_cedente = 555444
|
317
318
|
end
|
318
319
|
end
|
319
320
|
|
320
|
-
|
321
|
+
it { expect(subject.linha_digitavel).to eq '' }
|
321
322
|
end
|
322
323
|
|
323
|
-
|
324
324
|
context "'codigo_cedente' with 6 digits and 'nosso numero' with 17 digits" do
|
325
325
|
subject do
|
326
326
|
BancoBrasil.new do |banco_brasil|
|
@@ -328,16 +328,14 @@ module BoletoBancario
|
|
328
328
|
banco_brasil.valor_documento = 14001.99
|
329
329
|
banco_brasil.numero_documento = 12345678911234567
|
330
330
|
banco_brasil.agencia = 5030
|
331
|
-
banco_brasil.digito_agencia = 6
|
332
331
|
banco_brasil.conta_corrente = 14204195
|
333
|
-
banco_brasil.digito_conta_corrente = 7
|
334
332
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
335
333
|
banco_brasil.codigo_cedente = 555444
|
336
334
|
end
|
337
335
|
end
|
338
336
|
|
339
|
-
|
340
|
-
|
337
|
+
it { expect(subject.codigo_de_barras).to eq '00194556100014001995554441234567891123456721' }
|
338
|
+
it { expect(subject.linha_digitavel).to eq '00195.55440 41234.567893 11234.567219 4 55610001400199' }
|
341
339
|
end
|
342
340
|
|
343
341
|
context "'codigo_cedente' with 7 digits" do
|
@@ -347,16 +345,14 @@ module BoletoBancario
|
|
347
345
|
banco_brasil.valor_documento = 2952.95
|
348
346
|
banco_brasil.numero_documento = 87654
|
349
347
|
banco_brasil.agencia = 9999
|
350
|
-
banco_brasil.digito_agencia = 6
|
351
348
|
banco_brasil.conta_corrente = 99999
|
352
|
-
banco_brasil.digito_conta_corrente = 7
|
353
349
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
354
350
|
banco_brasil.codigo_cedente = 7777777
|
355
351
|
end
|
356
352
|
end
|
357
353
|
|
358
|
-
|
359
|
-
|
354
|
+
it { expect(subject.codigo_de_barras).to eq '00197556100002952950000007777777000008765418' }
|
355
|
+
it { expect(subject.linha_digitavel).to eq '00190.00009 07777.777009 00087.654182 7 55610000295295' }
|
360
356
|
end
|
361
357
|
|
362
358
|
context "'codigo_cedente' with 8 digits" do
|
@@ -366,18 +362,16 @@ module BoletoBancario
|
|
366
362
|
banco_brasil.valor_documento = 2952.95
|
367
363
|
banco_brasil.numero_documento = 87654
|
368
364
|
banco_brasil.agencia = 9999
|
369
|
-
banco_brasil.digito_agencia = 6
|
370
365
|
banco_brasil.conta_corrente = 99999
|
371
|
-
banco_brasil.digito_conta_corrente = 7
|
372
366
|
banco_brasil.data_vencimento = Date.parse('2012-12-28')
|
373
367
|
banco_brasil.codigo_cedente = 77777778
|
374
368
|
end
|
375
369
|
end
|
376
370
|
|
377
|
-
|
378
|
-
|
371
|
+
it { expect(subject.codigo_de_barras).to eq '00191556100002952950000007777777800008765418' }
|
372
|
+
it { expect(subject.linha_digitavel).to eq '00190.00009 07777.777801 00087.654182 1 55610000295295' }
|
379
373
|
end
|
380
374
|
end
|
381
375
|
end
|
382
376
|
end
|
383
|
-
end
|
377
|
+
end
|