br_danfe 0.16.0 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +20 -8
- data/.github/dependabot.yml +19 -0
- data/.rubocop.yml +24 -11
- data/Gemfile.lock +41 -35
- data/Guardfile +3 -1
- data/bin/_guard-core +29 -0
- data/bin/guard +29 -0
- data/br_danfe.gemspec +7 -6
- data/lib/br_danfe/danfe_lib/nfce.rb +11 -9
- data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +30 -16
- data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
- data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
- data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
- data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
- data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +6 -7
- data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
- data/lib/br_danfe/helper.rb +1 -1
- data/lib/br_danfe/mdfe.rb +1 -1
- data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +1 -1
- data/lib/br_danfe/mdfe_lib/fisco_control.rb +6 -25
- data/lib/br_danfe/mdfe_lib/header.rb +7 -8
- data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +1 -1
- data/lib/br_danfe/mdfe_lib/notes.rb +1 -1
- data/lib/br_danfe/qr_code.rb +1 -2
- data/lib/br_danfe/version.rb +1 -1
- data/lib/br_danfe.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +6 -4
- data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
- data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
- data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
- data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
- data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
- data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
- data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
- data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +55 -37
- data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
- data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +237 -237
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
- data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
- data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
- data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
- data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
- data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
- data/spec/br_danfe/danfe_spec.rb +2 -2
- data/spec/br_danfe/helper_spec.rb +15 -15
- data/spec/br_danfe/mdfe_lib/document_spec.rb +2 -2
- data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +21 -7
- data/spec/br_danfe/mdfe_lib/header_spec.rb +27 -18
- data/spec/br_danfe/mdfe_lib/notes_spec.rb +5 -5
- data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +1 -1
- data/spec/br_danfe/mdfe_spec.rb +4 -5
- data/spec/br_danfe/qr_code_spec.rb +4 -13
- data/spec/br_danfe/xml_spec.rb +6 -6
- data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
- data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
- data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
- data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
- data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
- data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +945 -0
- data/spec/spec_helper.rb +1 -1
- metadata +38 -16
@@ -14,18 +14,18 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
14
14
|
|
15
15
|
context 'when IE is valid' do
|
16
16
|
let(:xml_as_string) do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
<<~XML
|
18
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
19
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
20
|
+
<transp>
|
21
|
+
<transporta>
|
22
|
+
<IE>964508990089</IE>
|
23
|
+
<UF>SP</UF>
|
24
|
+
</transporta>
|
25
|
+
</transp>
|
26
|
+
</infNFe>
|
27
|
+
</NFe>
|
28
|
+
XML
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'renders a box with a formated IE to the pdf' do
|
@@ -40,18 +40,18 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
40
40
|
|
41
41
|
context 'when IE is invalid' do
|
42
42
|
let(:xml_as_string) do
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
<<~XML
|
44
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
45
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
46
|
+
<transp>
|
47
|
+
<transporta>
|
48
|
+
<IE>123</IE>
|
49
|
+
<UF>SC</UF>
|
50
|
+
</transporta>
|
51
|
+
</transp>
|
52
|
+
</infNFe>
|
53
|
+
</NFe>
|
54
|
+
XML
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'renders a blank box to the pdf' do
|
@@ -66,16 +66,16 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
66
66
|
|
67
67
|
context 'when IE is blank' do
|
68
68
|
let(:xml_as_string) do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
69
|
+
<<~XML
|
70
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
71
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
72
|
+
<transp>
|
73
|
+
<transporta>
|
74
|
+
</transporta>
|
75
|
+
</transp>
|
76
|
+
</infNFe>
|
77
|
+
</NFe>
|
78
|
+
XML
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'renders a blank box to the pdf' do
|
@@ -89,17 +89,17 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
89
89
|
|
90
90
|
context 'when UF is invalid' do
|
91
91
|
let(:xml_as_string) do
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
92
|
+
<<~XML
|
93
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
94
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
95
|
+
<transp>
|
96
|
+
<transporta>
|
97
|
+
<UF>SC</UF>
|
98
|
+
</transporta>
|
99
|
+
</transp>
|
100
|
+
</infNFe>
|
101
|
+
</NFe>
|
102
|
+
XML
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'renders a blank box to the pdf' do
|
@@ -122,17 +122,17 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
122
122
|
|
123
123
|
context 'when CNPJ is valid' do
|
124
124
|
let(:xml_as_string) do
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
125
|
+
<<~XML
|
126
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
127
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
128
|
+
<transp>
|
129
|
+
<transporta>
|
130
|
+
<CNPJ>71434064000149</CNPJ>
|
131
|
+
</transporta>
|
132
|
+
</transp>
|
133
|
+
</infNFe>
|
134
|
+
</NFe>
|
135
|
+
XML
|
136
136
|
end
|
137
137
|
|
138
138
|
it 'renders a box with a formated CNPJ to the pdf' do
|
@@ -147,17 +147,17 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
147
147
|
|
148
148
|
context 'when CNPJ is invalid' do
|
149
149
|
let(:xml_as_string) do
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
150
|
+
<<~XML
|
151
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
152
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
153
|
+
<transp>
|
154
|
+
<transporta>
|
155
|
+
<CNPJ>714</CNPJ>
|
156
|
+
</transporta>
|
157
|
+
</transp>
|
158
|
+
</infNFe>
|
159
|
+
</NFe>
|
160
|
+
XML
|
161
161
|
end
|
162
162
|
|
163
163
|
it 'renders a blank box to the pdf' do
|
@@ -172,16 +172,16 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
172
172
|
|
173
173
|
context 'when CNPJ is blank' do
|
174
174
|
let(:xml_as_string) do
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
175
|
+
<<~XML
|
176
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
177
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
178
|
+
<transp>
|
179
|
+
<transporta>
|
180
|
+
</transporta>
|
181
|
+
</transp>
|
182
|
+
</infNFe>
|
183
|
+
</NFe>
|
184
|
+
XML
|
185
185
|
end
|
186
186
|
|
187
187
|
it 'renders a blank box to the pdf' do
|
@@ -11,29 +11,29 @@ describe BrDanfe::DanfeLib::NfeLib::Dup do
|
|
11
11
|
|
12
12
|
describe '#render' do
|
13
13
|
let(:xml_as_string) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
14
|
+
<<~XML
|
15
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
16
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
17
|
+
<cobr>
|
18
|
+
<dup>
|
19
|
+
<nDup>1</nDup>
|
20
|
+
<dVenc>2015-02-13</dVenc>
|
21
|
+
<vDup>25.56</vDup>
|
22
|
+
</dup>
|
23
|
+
<dup>
|
24
|
+
<nDup>2</nDup>
|
25
|
+
<dVenc>2015-03-15</dVenc>
|
26
|
+
<vDup>25.56</vDup>
|
27
|
+
</dup>
|
28
|
+
<dup>
|
29
|
+
<nDup>3</nDup>
|
30
|
+
<dVenc>2015-04-14</dVenc>
|
31
|
+
<vDup>25.55</vDup>
|
32
|
+
</dup>
|
33
|
+
</cobr>
|
34
|
+
</infNFe>
|
35
|
+
</NFe>
|
36
|
+
XML
|
37
37
|
end
|
38
38
|
|
39
39
|
before do
|
@@ -12,43 +12,61 @@ describe BrDanfe::DanfeLib::NfeLib::EmitHeader do
|
|
12
12
|
|
13
13
|
describe '#render' do
|
14
14
|
let(:xml_as_string) do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
15
|
+
<<~XML
|
16
|
+
<nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
|
17
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
18
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
19
|
+
<ide>
|
20
|
+
<tpNF>1</tpNF>
|
21
|
+
<nNF>1</nNF>
|
22
|
+
<serie>1</serie>
|
23
|
+
<natOp>Vendas de producao do estabelecimento</natOp>
|
24
|
+
</ide>
|
25
|
+
<emit>
|
26
|
+
<xNome>Nome do Remetente Ltda</xNome>
|
27
|
+
<CNPJ>62013294000143</CNPJ>
|
28
|
+
<IE>526926313553</IE>
|
29
|
+
<IEST>611724092039</IEST>
|
30
|
+
<enderEmit>
|
31
|
+
<xLgr>Rua do Remetente, Casa</xLgr>
|
32
|
+
<nro>123</nro>
|
33
|
+
<xBairro>Bairro do Remetente</xBairro>
|
34
|
+
<xMun>SAO PAULO</xMun>
|
35
|
+
<UF>SP</UF>
|
36
|
+
<CEP>12345678</CEP>
|
37
|
+
<fone>1112345678</fone>
|
38
|
+
<email>foo@bar.com</email>
|
39
|
+
</enderEmit>
|
40
|
+
</emit>
|
41
|
+
<det nItem="1">
|
42
|
+
<prod>
|
43
|
+
<detExport>
|
44
|
+
<exportInd>
|
45
|
+
<chNFe>41211285493849000105550020000027171182910239</chNFe>
|
46
|
+
</exportInd>
|
47
|
+
</detExport>
|
48
|
+
</prod>
|
49
|
+
</det>
|
50
|
+
</infNFe>
|
51
|
+
</NFe>
|
52
|
+
<protNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
|
53
|
+
<infProt Id="ID325110012866320">
|
54
|
+
<chNFe>25111012345678901234550020000134151000134151</chNFe>
|
55
|
+
<dhRecbto>2011-10-29T14:37:09</dhRecbto>
|
56
|
+
<nProt>325110012866320</nProt>
|
57
|
+
</infProt>
|
58
|
+
</protNFe>
|
59
|
+
</nfeProc>
|
60
|
+
XML
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'renders only the nfe key' do
|
64
|
+
subject.render 2, 1.85, 2
|
65
|
+
File.delete(output_pdf) if File.exist?(output_pdf)
|
66
|
+
|
67
|
+
pdf.render_file output_pdf
|
68
|
+
|
69
|
+
expect("#{base_dir}emit_header#render-nfe_key.pdf").to have_same_content_of file: output_pdf
|
52
70
|
end
|
53
71
|
|
54
72
|
context 'render emitter on first page' do
|
@@ -4,12 +4,12 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
4
4
|
describe '.format_date' do
|
5
5
|
it 'returns a formated string' do
|
6
6
|
string = '2013-10-18T13:54:04'
|
7
|
-
expect(
|
7
|
+
expect(described_class.format_date(string)).to eq '18/10/2013'
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'when the source is blank' do
|
11
11
|
it 'is empty' do
|
12
|
-
expect(
|
12
|
+
expect(described_class.format_date('')).to eq ''
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -19,7 +19,7 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
19
19
|
let(:param) { '2013-10-18T16:54:04-03:00' }
|
20
20
|
|
21
21
|
it 'is a formated time string in localtime' do
|
22
|
-
expect(
|
22
|
+
expect(described_class.format_time(param)).to eq '16:54:04'
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,7 +27,7 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
27
27
|
let(:param) { '14:23:02' }
|
28
28
|
|
29
29
|
it 'is a formated time string' do
|
30
|
-
expect(
|
30
|
+
expect(described_class.format_time(param)).to eq '14:23:02'
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,7 +35,7 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
35
35
|
let(:param) { '' }
|
36
36
|
|
37
37
|
it 'is empty' do
|
38
|
-
expect(
|
38
|
+
expect(described_class.format_time(param)).to eq ''
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -47,7 +47,7 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
47
47
|
let(:address) { 'Rua do governo do estado 1125 - Em anexo ao super mercado maior do bairro' }
|
48
48
|
|
49
49
|
it 'returns true' do
|
50
|
-
expect(
|
50
|
+
expect(described_class.address_is_too_big(pdf, address)).to be true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -55,20 +55,20 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
55
55
|
let(:address) { 'Rua do governo do estado 1125 - Salas 1 e 2' }
|
56
56
|
|
57
57
|
it 'returns false' do
|
58
|
-
expect(
|
58
|
+
expect(described_class.address_is_too_big(pdf, address)).to be false
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe '.generate_address' do
|
64
64
|
let(:xml) do
|
65
|
-
|
65
|
+
<<~XML
|
66
66
|
<enderDest>
|
67
67
|
<xLgr>Rua do governo do estado</xLgr>
|
68
68
|
<nro>1125</nro>
|
69
69
|
<xCpl>Em anexo ao super mercado maior do bairro</xCpl>
|
70
70
|
</enderDest>
|
71
|
-
|
71
|
+
XML
|
72
72
|
end
|
73
73
|
|
74
74
|
let(:xml_street) do
|
@@ -76,57 +76,57 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'returns the address with the street, number and complement' do
|
79
|
-
expect(
|
79
|
+
expect(described_class.generate_address(xml_street))
|
80
80
|
.to eq 'Rua do governo do estado 1125 - Em anexo ao super mercado maior do bairro'
|
81
81
|
end
|
82
82
|
|
83
83
|
context "when recipient address hasn't complement" do
|
84
84
|
let(:xml) do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
<<~XML
|
86
|
+
<enderDest>
|
87
|
+
<xLgr>Rua do governo do estado</xLgr>
|
88
|
+
<nro>1125</nro>
|
89
|
+
<xCpl></xCpl>
|
90
|
+
</enderDest>
|
91
|
+
XML
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'returns the address with the street and number' do
|
95
|
-
expect(
|
95
|
+
expect(described_class.generate_address(xml_street))
|
96
96
|
.to eq 'Rua do governo do estado 1125'
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
context "when recipient address hasn't complement and number" do
|
101
101
|
let(:xml) do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
102
|
+
<<~XML
|
103
|
+
<enderDest>
|
104
|
+
<xLgr>Rua do governo do estado</xLgr>
|
105
|
+
<nro></nro>
|
106
|
+
<xCpl></xCpl>
|
107
|
+
</enderDest>
|
108
|
+
XML
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'returns the address with the street only' do
|
112
|
-
expect(
|
112
|
+
expect(described_class.generate_address(xml_street))
|
113
113
|
.to eq 'Rua do governo do estado'
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
context "when recipient address hasn't number" do
|
118
118
|
let(:xml) do
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
119
|
+
<<~XML
|
120
|
+
<enderDest>
|
121
|
+
<xLgr>Rua do governo do estado</xLgr>
|
122
|
+
<nro></nro>
|
123
|
+
<xCpl>Em anexo ao super mercado maior do bairro</xCpl>
|
124
|
+
</enderDest>
|
125
|
+
XML
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'returns the address with the street and complement' do
|
129
|
-
expect(
|
129
|
+
expect(described_class.generate_address(xml_street))
|
130
130
|
.to eq 'Rua do governo do estado - Em anexo ao super mercado maior do bairro'
|
131
131
|
end
|
132
132
|
end
|
@@ -11,25 +11,25 @@ describe BrDanfe::DanfeLib::NfeLib::Icmstot do
|
|
11
11
|
|
12
12
|
describe '#render' do
|
13
13
|
let(:xml_as_string) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
<<~XML
|
15
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
16
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
17
|
+
<ICMSTot>
|
18
|
+
<vBC>1.23</vBC>
|
19
|
+
<vICMS>2.34</vICMS>
|
20
|
+
<vBCST>3.45</vBCST>
|
21
|
+
<vST>4.56</vST>
|
22
|
+
<vProd>5.67</vProd>
|
23
|
+
<vFrete>6.78</vFrete>
|
24
|
+
<vSeg>7.89</vSeg>
|
25
|
+
<vDesc>9.01</vDesc>
|
26
|
+
<vIPI>0.12</vIPI>
|
27
|
+
<vOutro>1.34</vOutro>
|
28
|
+
<vNF>4.35</vNF>
|
29
|
+
</ICMSTot>
|
30
|
+
</infNFe>
|
31
|
+
</NFe>
|
32
|
+
XML
|
33
33
|
end
|
34
34
|
|
35
35
|
before do
|