br_danfe 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/.rubocop.yml +113 -0
- data/Gemfile.lock +40 -19
- data/Rakefile +3 -3
- data/br_danfe.gemspec +7 -7
- data/lib/br_danfe.rb +14 -14
- data/lib/br_danfe/cce.rb +1 -0
- data/lib/br_danfe/cce_lib/barcode.rb +3 -2
- data/lib/br_danfe/cce_lib/correction.rb +3 -2
- data/lib/br_danfe/cce_lib/document.rb +15 -5
- data/lib/br_danfe/cce_lib/footer.rb +1 -1
- data/lib/br_danfe/cce_lib/header.rb +1 -1
- data/lib/br_danfe/cce_lib/nfe_key.rb +4 -3
- data/lib/br_danfe/cce_lib/protocol.rb +4 -3
- data/lib/br_danfe/danfe.rb +17 -17
- data/lib/br_danfe/danfe_lib/cep.rb +1 -1
- data/lib/br_danfe/danfe_lib/cst.rb +8 -6
- data/lib/br_danfe/danfe_lib/dest.rb +21 -23
- data/lib/br_danfe/danfe_lib/det_body.rb +20 -20
- data/lib/br_danfe/danfe_lib/document.rb +49 -36
- data/lib/br_danfe/danfe_lib/dup.rb +11 -10
- data/lib/br_danfe/danfe_lib/emit_header.rb +38 -34
- data/lib/br_danfe/danfe_lib/helper.rb +23 -23
- data/lib/br_danfe/danfe_lib/icmstot.rb +12 -12
- data/lib/br_danfe/danfe_lib/infadic.rb +1 -0
- data/lib/br_danfe/danfe_lib/issqn.rb +6 -6
- data/lib/br_danfe/danfe_lib/options.rb +6 -5
- data/lib/br_danfe/danfe_lib/phone.rb +2 -2
- data/lib/br_danfe/danfe_lib/ticket.rb +6 -4
- data/lib/br_danfe/danfe_lib/transp.rb +27 -26
- data/lib/br_danfe/danfe_lib/vol.rb +9 -8
- data/lib/br_danfe/danfe_lib/xml.rb +6 -6
- data/lib/br_danfe/danfe_lib/xprod.rb +22 -23
- data/lib/br_danfe/uf.rb +1 -4
- data/lib/br_danfe/version.rb +1 -1
- data/spec/features/cce_spec.rb +6 -6
- data/spec/features/danfe_spec.rb +25 -25
- data/spec/fixtures/cce/lib/barcode#render.pdf +5 -1
- data/spec/fixtures/cce/lib/correction#render.pdf +6 -2
- data/spec/fixtures/cce/lib/document#box.pdf +5 -1
- data/spec/fixtures/cce/lib/document#box.with.block.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.align.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.pad.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.simple.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.size.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.style.pdf +6 -2
- data/spec/fixtures/cce/lib/footer#render.pdf +6 -2
- data/spec/fixtures/cce/lib/header#render.pdf +6 -2
- data/spec/fixtures/cce/lib/nfe_key#render.pdf +7 -3
- data/spec/fixtures/cce/lib/protocol#render.pdf +7 -3
- data/spec/fixtures/cce/v1.00/cce.fixture.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +7 -3
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +383 -379
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +233 -229
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +3697 -3685
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +3540 -3532
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +1665 -1657
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +1665 -1657
- data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-blank.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-valid.pdf +6 -2
- data/spec/fixtures/nfe/lib/dup#render.pdf +8 -4
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +9 -5
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +9 -5
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +7 -3
- data/spec/fixtures/nfe/lib/icmstot#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +8 -4
- data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +8 -4
- data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +5 -1
- data/spec/fixtures/nfe/lib/ticket#render.pdf +6 -2
- data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +6 -2
- data/spec/fixtures/nfe/lib/vol#render.pdf +6 -2
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +317 -313
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +315 -311
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +1297 -1289
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +165 -161
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +1297 -1289
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +314 -310
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +765 -761
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +1222 -1214
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +1222 -1214
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +4004 -3992
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +1522 -1514
- data/spec/lib/cce_lib/barcode_spec.rb +5 -5
- data/spec/lib/cce_lib/correction_spec.rb +5 -5
- data/spec/lib/cce_lib/document_spec.rb +23 -23
- data/spec/lib/cce_lib/footer_spec.rb +4 -4
- data/spec/lib/cce_lib/header_spec.rb +4 -4
- data/spec/lib/cce_lib/nfe_key_spec.rb +5 -5
- data/spec/lib/cce_lib/protocol_spec.rb +5 -5
- data/spec/lib/danfe_lib/cep_spec.rb +5 -5
- data/spec/lib/danfe_lib/cst_spec.rb +8 -8
- data/spec/lib/danfe_lib/dest_spec.rb +23 -23
- data/spec/lib/danfe_lib/det_body_spec.rb +26 -26
- data/spec/lib/danfe_lib/document_spec.rb +25 -25
- data/spec/lib/danfe_lib/dup_spec.rb +4 -4
- data/spec/lib/danfe_lib/emit_header_spec.rb +13 -13
- data/spec/lib/danfe_lib/helper_spec.rb +74 -74
- data/spec/lib/danfe_lib/icmstot_spec.rb +4 -4
- data/spec/lib/danfe_lib/infadic_spec.rb +6 -13
- data/spec/lib/danfe_lib/infadic_vol_spec.rb +1 -4
- data/spec/lib/danfe_lib/issqn_spec.rb +11 -11
- data/spec/lib/danfe_lib/logo_options_spec.rb +18 -18
- data/spec/lib/danfe_lib/options_spec.rb +7 -7
- data/spec/lib/danfe_lib/phone_spec.rb +10 -10
- data/spec/lib/danfe_lib/plate_spec.rb +9 -9
- data/spec/lib/danfe_lib/ticket_spec.rb +4 -4
- data/spec/lib/danfe_lib/transp_spec.rb +10 -10
- data/spec/lib/danfe_lib/vol_spec.rb +7 -7
- data/spec/lib/danfe_lib/xml_spec.rb +5 -5
- data/spec/lib/danfe_lib/xprod_spec.rb +48 -50
- data/spec/lib/uf_spec.rb +12 -12
- data/spec/support/have_same_content_of.rb +6 -6
- metadata +40 -10
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe BrDanfe::DanfeLib::XML do
|
4
4
|
subject { BrDanfe::DanfeLib::XML.new(xml_as_string) }
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe '#version_is_310_or_newer?' do
|
7
7
|
describe "when xml's version is equal 3.10" do
|
8
8
|
let(:xml_as_string) do
|
9
9
|
<<-eos
|
@@ -14,7 +14,7 @@ describe BrDanfe::DanfeLib::XML do
|
|
14
14
|
eos
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
17
|
+
it 'returns true' do
|
18
18
|
expect(subject.version_is_310_or_newer?).to eql true
|
19
19
|
end
|
20
20
|
end
|
@@ -29,7 +29,7 @@ describe BrDanfe::DanfeLib::XML do
|
|
29
29
|
eos
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it 'returns true' do
|
33
33
|
expect(subject.version_is_310_or_newer?).to eql true
|
34
34
|
end
|
35
35
|
end
|
@@ -44,7 +44,7 @@ describe BrDanfe::DanfeLib::XML do
|
|
44
44
|
eos
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
47
|
+
it 'returns false' do
|
48
48
|
expect(subject.version_is_310_or_newer?).to eql false
|
49
49
|
end
|
50
50
|
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "spec_helper"
|
1
|
+
require 'spec_helper'
|
4
2
|
|
5
3
|
describe BrDanfe::DanfeLib::Xprod do
|
6
|
-
describe
|
7
|
-
context
|
4
|
+
describe '#render' do
|
5
|
+
context 'when has FCI' do
|
8
6
|
let(:xml_fci) do
|
9
7
|
xml = <<-eos
|
10
8
|
<det nItem="1">
|
@@ -20,16 +18,16 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
20
18
|
|
21
19
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_fci) }
|
22
20
|
|
23
|
-
it
|
24
|
-
expected =
|
21
|
+
it 'returns product + FCI' do
|
22
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
25
23
|
expected += "\n"
|
26
|
-
expected +=
|
24
|
+
expected += 'FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386'
|
27
25
|
expect(subject.render).to eq expected
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
context
|
32
|
-
context
|
29
|
+
context 'when has ST' do
|
30
|
+
context 'when is Retido' do
|
33
31
|
let(:vBCSTRet) { 0.00 }
|
34
32
|
let(:pST) { 0.00 }
|
35
33
|
let(:vICMSSTRet) { 0.00 }
|
@@ -70,45 +68,45 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
70
68
|
|
71
69
|
subject { BrDanfe::DanfeLib::Xprod.new(xml) }
|
72
70
|
|
73
|
-
context
|
71
|
+
context 'when has vBCSTRet' do
|
74
72
|
let(:vBCSTRet) { 50.00 }
|
75
73
|
|
76
|
-
it
|
77
|
-
expected =
|
74
|
+
it 'returns product + ST Retido' do
|
75
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
78
76
|
expected += "\n"
|
79
|
-
expected +=
|
77
|
+
expected += 'ST Retido: Base: 50,00 * Alíq: 0,00% * Vlr: 0,00'
|
80
78
|
|
81
79
|
expect(subject.render).to eq expected
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
85
|
-
context
|
83
|
+
context 'when has vICMSSTRet' do
|
86
84
|
let(:vICMSSTRet) { 50.00 }
|
87
85
|
|
88
|
-
it
|
89
|
-
expected =
|
86
|
+
it 'returns product + ST Retido' do
|
87
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
90
88
|
expected += "\n"
|
91
|
-
expected +=
|
89
|
+
expected += 'ST Retido: Base: 0,00 * Alíq: 0,00% * Vlr: 50,00'
|
92
90
|
|
93
91
|
expect(subject.render).to eq expected
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
97
|
-
context
|
95
|
+
context 'when has pST' do
|
98
96
|
let(:pST) { 50.00 }
|
99
97
|
|
100
|
-
it
|
101
|
-
expected =
|
98
|
+
it 'returns product + ST Retido' do
|
99
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
102
100
|
expected += "\n"
|
103
|
-
expected +=
|
101
|
+
expected += 'ST Retido: Base: 0,00 * Alíq: 50,00% * Vlr: 0,00'
|
104
102
|
|
105
103
|
expect(subject.render).to eq expected
|
106
104
|
end
|
107
105
|
end
|
108
106
|
|
109
107
|
context "when doesn't have any fields" do
|
110
|
-
it
|
111
|
-
expected =
|
108
|
+
it 'returns product' do
|
109
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
112
110
|
|
113
111
|
expect(subject.render).to eq expected
|
114
112
|
end
|
@@ -141,17 +139,17 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
141
139
|
|
142
140
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_st) }
|
143
141
|
|
144
|
-
it
|
145
|
-
expected =
|
142
|
+
it 'returns product + ST' do
|
143
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
146
144
|
expected += "\n"
|
147
|
-
expected +=
|
145
|
+
expected += 'ST: MVA: 56,00% * Alíq: 17,00% * BC: 479,82 * Vlr: 29,28'
|
148
146
|
|
149
147
|
expect(subject.render).to eq expected
|
150
148
|
end
|
151
149
|
end
|
152
150
|
end
|
153
151
|
|
154
|
-
context
|
152
|
+
context 'when has infAdProd' do
|
155
153
|
let(:xml_infAdProd) do
|
156
154
|
xml = <<-eos
|
157
155
|
<det nItem="1">
|
@@ -167,16 +165,16 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
167
165
|
|
168
166
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_infAdProd) }
|
169
167
|
|
170
|
-
it
|
171
|
-
expected =
|
168
|
+
it 'returns product + infAdProd' do
|
169
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
172
170
|
expected += "\n"
|
173
|
-
expected +=
|
171
|
+
expected += 'Informações adicionais do produto'
|
174
172
|
|
175
173
|
expect(subject.render).to eq expected
|
176
174
|
end
|
177
175
|
end
|
178
176
|
|
179
|
-
context
|
177
|
+
context 'when has FCP on ICMS00 tag' do
|
180
178
|
let(:xml_fcp) do
|
181
179
|
xml = <<-eos
|
182
180
|
<det nItem="1">
|
@@ -200,16 +198,16 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
200
198
|
|
201
199
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_fcp) }
|
202
200
|
|
203
|
-
it
|
204
|
-
expected =
|
201
|
+
it 'returns product + FCP' do
|
202
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
205
203
|
expected += "\n"
|
206
|
-
expected +=
|
204
|
+
expected += 'FCP: Alíq: 2,00% * Vlr: 4,71'
|
207
205
|
|
208
206
|
expect(subject.render).to eq expected
|
209
207
|
end
|
210
208
|
end
|
211
209
|
|
212
|
-
context
|
210
|
+
context 'when has FCI + ST + infAdProd + FCP' do
|
213
211
|
let(:xml_IFC_ST_infAdProd) do
|
214
212
|
xml = <<-eos
|
215
213
|
<det nItem="1">
|
@@ -241,22 +239,22 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
241
239
|
|
242
240
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_IFC_ST_infAdProd) }
|
243
241
|
|
244
|
-
it
|
245
|
-
expected =
|
242
|
+
it 'returns product + FCI + ST + infAdProd' do
|
243
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
246
244
|
expected += "\n"
|
247
|
-
expected +=
|
245
|
+
expected += 'Informações adicionais do produto'
|
248
246
|
expected += "\n"
|
249
|
-
expected +=
|
247
|
+
expected += 'FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386'
|
250
248
|
expected += "\n"
|
251
|
-
expected +=
|
249
|
+
expected += 'ST: MVA: 56,00% * Alíq: 17,00% * BC: 479,82 * Vlr: 29,28'
|
252
250
|
expected += "\n"
|
253
|
-
expected +=
|
251
|
+
expected += 'FCP: Alíq: 2,00% * Vlr: 4,71'
|
254
252
|
|
255
253
|
expect(subject.render).to eq expected
|
256
254
|
end
|
257
255
|
end
|
258
256
|
|
259
|
-
context
|
257
|
+
context 'when FCP is not in a ICMS00 tag' do
|
260
258
|
let(:xml_fcp) do
|
261
259
|
xml = <<-eos
|
262
260
|
<det nItem="1">
|
@@ -281,16 +279,16 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
281
279
|
|
282
280
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_fcp) }
|
283
281
|
|
284
|
-
it
|
285
|
-
expected =
|
282
|
+
it 'returns product + FCP' do
|
283
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
286
284
|
expected += "\n"
|
287
|
-
expected +=
|
285
|
+
expected += 'FCP: Base: 235,50 * Alíq: 2,00% * Vlr: 4,71'
|
288
286
|
|
289
287
|
expect(subject.render).to eq expected
|
290
288
|
end
|
291
289
|
end
|
292
290
|
|
293
|
-
context
|
291
|
+
context 'when has FCP ST' do
|
294
292
|
let(:xml_fcp) do
|
295
293
|
xml = <<-eos
|
296
294
|
<det nItem="1">
|
@@ -315,10 +313,10 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
315
313
|
|
316
314
|
subject { BrDanfe::DanfeLib::Xprod.new(xml_fcp) }
|
317
315
|
|
318
|
-
it
|
319
|
-
expected =
|
316
|
+
it 'returns product + FCP' do
|
317
|
+
expected = 'MONITOR DE ARCO ELETRICO'
|
320
318
|
expected += "\n"
|
321
|
-
expected +=
|
319
|
+
expected += 'FCP ST: Base: 235,50 * Alíq: 2,00% * Vlr: 4,71'
|
322
320
|
|
323
321
|
expect(subject.render).to eq expected
|
324
322
|
end
|
data/spec/lib/uf_spec.rb
CHANGED
@@ -3,15 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe BrDanfe::Uf do
|
4
4
|
describe '#include?' do
|
5
5
|
ufs =
|
6
|
-
[
|
7
|
-
|
8
|
-
|
6
|
+
%w[
|
7
|
+
AC AL AP AM BA CE DF ES GO MA MT MS MG PA PB PR PE PI RJ
|
8
|
+
RN RS RO RR SC SP SE TO
|
9
9
|
]
|
10
10
|
|
11
11
|
context 'when uf is symbol' do
|
12
12
|
ufs.each do |uf|
|
13
13
|
it "returns true for uf #{uf}" do
|
14
|
-
expect(BrDanfe::Uf.include?
|
14
|
+
expect(BrDanfe::Uf.include?(uf.to_sym)).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -19,27 +19,27 @@ describe BrDanfe::Uf do
|
|
19
19
|
context 'when uf is string' do
|
20
20
|
ufs.each do |uf|
|
21
21
|
it "returns true for uf #{uf}" do
|
22
|
-
expect(BrDanfe::Uf.include?
|
22
|
+
expect(BrDanfe::Uf.include?(uf)).to be true
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when uf is not from Brazil' do
|
28
|
-
it
|
29
|
-
expect(BrDanfe::Uf.include?
|
28
|
+
it 'returns false' do
|
29
|
+
expect(BrDanfe::Uf.include?('EX')).to be false
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'when uf is blank' do
|
34
|
-
it
|
35
|
-
expect(BrDanfe::Uf.include?
|
34
|
+
it 'returns false' do
|
35
|
+
expect(BrDanfe::Uf.include?('')).to be false
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when uf is nil' do
|
40
|
-
it
|
41
|
-
expect(BrDanfe::Uf.include?
|
40
|
+
it 'returns false' do
|
41
|
+
expect(BrDanfe::Uf.include?(nil)).to be false
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
@@ -2,7 +2,7 @@ RSpec::Matchers.define(:have_same_content_of) do |file: nil|
|
|
2
2
|
expected_file_path = file
|
3
3
|
|
4
4
|
match do |actual_file_path|
|
5
|
-
if File.
|
5
|
+
if File.exist?(actual_file_path)
|
6
6
|
expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path))
|
7
7
|
else
|
8
8
|
create_when_missing(expected_file_path, actual_file_path)
|
@@ -14,13 +14,13 @@ RSpec::Matchers.define(:have_same_content_of) do |file: nil|
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_when_missing(expected_file_path, actual_file_path)
|
17
|
-
puts
|
18
|
-
puts
|
17
|
+
puts '+----------------------------------------------------'
|
18
|
+
puts '|'
|
19
19
|
puts "| The file bellow doesn't exists and will be created:"
|
20
|
-
puts
|
20
|
+
puts '|'
|
21
21
|
puts "| #{actual_file_path}"
|
22
|
-
puts
|
23
|
-
puts
|
22
|
+
puts '|'
|
23
|
+
puts '+----------------------------------------------------'
|
24
24
|
|
25
25
|
FileUtils.cp(expected_file_path, actual_file_path)
|
26
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_danfe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: barby
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.1.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.1.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: i18n
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: prawn
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: '2.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: prawn-table
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,34 @@ dependencies:
|
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 3.6.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.67.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.67.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-performance
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.1.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.1.0
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: simplecov
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +202,7 @@ files:
|
|
174
202
|
- ".codeclimate.yml"
|
175
203
|
- ".gitignore"
|
176
204
|
- ".rspec"
|
205
|
+
- ".rubocop.yml"
|
177
206
|
- Dockerfile
|
178
207
|
- Gemfile
|
179
208
|
- Gemfile.lock
|
@@ -352,14 +381,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
352
381
|
requirements:
|
353
382
|
- - ">="
|
354
383
|
- !ruby/object:Gem::Version
|
355
|
-
version:
|
384
|
+
version: 2.5.1
|
356
385
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
357
386
|
requirements:
|
358
387
|
- - ">="
|
359
388
|
- !ruby/object:Gem::Version
|
360
389
|
version: '0'
|
361
390
|
requirements: []
|
362
|
-
|
391
|
+
rubyforge_project:
|
392
|
+
rubygems_version: 2.7.6
|
363
393
|
signing_key:
|
364
394
|
specification_version: 4
|
365
395
|
summary: DANFE pdf generator for Brazilian invoices.
|