br_danfe 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -8
  3. data/.github/dependabot.yml +19 -0
  4. data/.rubocop.yml +24 -11
  5. data/Gemfile.lock +38 -30
  6. data/Guardfile +3 -1
  7. data/bin/_guard-core +29 -0
  8. data/bin/guard +29 -0
  9. data/br_danfe.gemspec +6 -5
  10. data/lib/br_danfe/danfe_lib/nfce.rb +10 -8
  11. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +1 -2
  12. data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
  13. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
  14. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +4 -5
  15. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
  16. data/lib/br_danfe/helper.rb +1 -1
  17. data/lib/br_danfe/mdfe.rb +1 -1
  18. data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +1 -1
  19. data/lib/br_danfe/mdfe_lib/fisco_control.rb +6 -25
  20. data/lib/br_danfe/mdfe_lib/header.rb +7 -8
  21. data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +1 -1
  22. data/lib/br_danfe/mdfe_lib/notes.rb +1 -1
  23. data/lib/br_danfe/qr_code.rb +1 -2
  24. data/lib/br_danfe/version.rb +1 -1
  25. data/lib/br_danfe.rb +2 -2
  26. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
  27. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +2 -2
  28. data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
  29. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
  30. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
  31. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
  32. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
  33. data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
  34. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
  35. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
  36. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
  37. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
  38. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +37 -37
  39. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
  40. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
  41. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +237 -237
  42. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
  43. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
  44. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
  45. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
  46. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
  47. data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
  48. data/spec/br_danfe/danfe_spec.rb +2 -2
  49. data/spec/br_danfe/helper_spec.rb +15 -15
  50. data/spec/br_danfe/mdfe_lib/document_spec.rb +2 -2
  51. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +21 -7
  52. data/spec/br_danfe/mdfe_lib/header_spec.rb +27 -18
  53. data/spec/br_danfe/mdfe_lib/notes_spec.rb +5 -5
  54. data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +1 -1
  55. data/spec/br_danfe/mdfe_spec.rb +4 -5
  56. data/spec/br_danfe/qr_code_spec.rb +4 -13
  57. data/spec/br_danfe/xml_spec.rb +6 -6
  58. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  59. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  60. data/spec/spec_helper.rb +1 -1
  61. metadata +35 -14
@@ -11,19 +11,19 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
11
11
 
12
12
  describe '#render' do
13
13
  let(:xml_as_string) do
14
- <<-eos
15
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
- <ide>
18
- <nNF>1</nNF>
19
- <serie>1</serie>
20
- </ide>
21
- <emit>
22
- <xNome>Nome do Remetente Ltda</xNome>
23
- </emit>
24
- </infNFe>
25
- </NFe>
26
- eos
14
+ <<~XML
15
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
+ <ide>
18
+ <nNF>1</nNF>
19
+ <serie>1</serie>
20
+ </ide>
21
+ <emit>
22
+ <xNome>Nome do Remetente Ltda</xNome>
23
+ </emit>
24
+ </infNFe>
25
+ </NFe>
26
+ XML
27
27
  end
28
28
 
29
29
  before do
@@ -11,28 +11,28 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
11
11
 
12
12
  describe '#render' do
13
13
  let(:xml_as_string) do
14
- <<-eos
15
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
- <transp>
18
- <modFrete>0</modFrete>
19
- <transporta>
20
- <CNPJ>71434064000149</CNPJ>
21
- <xNome>Nome do Transportador Ltda</xNome>
22
- <IE>964508990089</IE>
23
- <xEnder>Rua do Transportador, 456</xEnder>
24
- <xMun>Votorantim</xMun>
25
- <UF>SP</UF>
26
- </transporta>
27
- <veicTransp>
28
- <placa>ABC-1234</placa>
29
- <UF>SP</UF>
30
- <RNTC>123456</RNTC>
31
- </veicTransp>
32
- </transp>
33
- </infNFe>
34
- </NFe>
35
- eos
14
+ <<~XML
15
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
+ <transp>
18
+ <modFrete>0</modFrete>
19
+ <transporta>
20
+ <CNPJ>71434064000149</CNPJ>
21
+ <xNome>Nome do Transportador Ltda</xNome>
22
+ <IE>964508990089</IE>
23
+ <xEnder>Rua do Transportador, 456</xEnder>
24
+ <xMun>Votorantim</xMun>
25
+ <UF>SP</UF>
26
+ </transporta>
27
+ <veicTransp>
28
+ <placa>ABC-1234</placa>
29
+ <UF>SP</UF>
30
+ <RNTC>123456</RNTC>
31
+ </veicTransp>
32
+ </transp>
33
+ </infNFe>
34
+ </NFe>
35
+ XML
36
36
  end
37
37
 
38
38
  before do
@@ -50,15 +50,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
50
50
 
51
51
  context 'when modFrete is 0' do
52
52
  let(:xml_as_string) do
53
- <<-eos
54
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
55
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
56
- <transp>
57
- <modFrete>0</modFrete>
58
- </transp>
59
- </infNFe>
60
- </NFe>
61
- eos
53
+ <<~XML
54
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
55
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
56
+ <transp>
57
+ <modFrete>0</modFrete>
58
+ </transp>
59
+ </infNFe>
60
+ </NFe>
61
+ XML
62
62
  end
63
63
 
64
64
  it "renders '0-Emitente' to the pdf" do
@@ -72,15 +72,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
72
72
 
73
73
  context 'when modFrete is 1' do
74
74
  let(:xml_as_string) do
75
- <<-eos
76
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
77
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
78
- <transp>
79
- <modFrete>1</modFrete>
80
- </transp>
81
- </infNFe>
82
- </NFe>
83
- eos
75
+ <<~XML
76
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
77
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
78
+ <transp>
79
+ <modFrete>1</modFrete>
80
+ </transp>
81
+ </infNFe>
82
+ </NFe>
83
+ XML
84
84
  end
85
85
 
86
86
  it "renders '1-Destinatário' to the pdf" do
@@ -94,15 +94,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
94
94
 
95
95
  context 'when modFrete is 2' do
96
96
  let(:xml_as_string) do
97
- <<-eos
98
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
99
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
100
- <transp>
101
- <modFrete>2</modFrete>
102
- </transp>
103
- </infNFe>
104
- </NFe>
105
- eos
97
+ <<~XML
98
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
99
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
100
+ <transp>
101
+ <modFrete>2</modFrete>
102
+ </transp>
103
+ </infNFe>
104
+ </NFe>
105
+ XML
106
106
  end
107
107
 
108
108
  it "renders '2-Terceiros' to the pdf" do
@@ -116,15 +116,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
116
116
 
117
117
  context 'when modFrete is 3' do
118
118
  let(:xml_as_string) do
119
- <<-eos
120
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
121
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
122
- <transp>
123
- <modFrete>3</modFrete>
124
- </transp>
125
- </infNFe>
126
- </NFe>
127
- eos
119
+ <<~XML
120
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
121
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
122
+ <transp>
123
+ <modFrete>3</modFrete>
124
+ </transp>
125
+ </infNFe>
126
+ </NFe>
127
+ XML
128
128
  end
129
129
 
130
130
  it "renders '3-Prop/Rem' to the pdf" do
@@ -138,15 +138,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
138
138
 
139
139
  context 'when modFrete is 4' do
140
140
  let(:xml_as_string) do
141
- <<-eos
142
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
143
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
144
- <transp>
145
- <modFrete>4</modFrete>
146
- </transp>
147
- </infNFe>
148
- </NFe>
149
- eos
141
+ <<~XML
142
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
143
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
144
+ <transp>
145
+ <modFrete>4</modFrete>
146
+ </transp>
147
+ </infNFe>
148
+ </NFe>
149
+ XML
150
150
  end
151
151
 
152
152
  it "renders '4-Prop/Dest' to the pdf" do
@@ -160,15 +160,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
160
160
 
161
161
  context 'when modFrete is 9' do
162
162
  let(:xml_as_string) do
163
- <<-eos
164
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
165
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
166
- <transp>
167
- <modFrete>9</modFrete>
168
- </transp>
169
- </infNFe>
170
- </NFe>
171
- eos
163
+ <<~XML
164
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
165
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
166
+ <transp>
167
+ <modFrete>9</modFrete>
168
+ </transp>
169
+ </infNFe>
170
+ </NFe>
171
+ XML
172
172
  end
173
173
 
174
174
  it "renders '9-Sem Frete' to the pdf" do
@@ -11,38 +11,38 @@ describe BrDanfe::DanfeLib::NfeLib::Vol do
11
11
 
12
12
  describe '#render' do
13
13
  let(:xml_as_string) do
14
- <<-eos
15
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
- <transp>
18
- <vol>
19
- <qVol>1</qVol>
20
- <esp>VOLUMES 1</esp>
21
- <marca>DIVERSOS 1</marca>
22
- <nVol>1</nVol>
23
- <pesoL>1000.000</pesoL>
24
- <pesoB>1100.000</pesoB>
25
- </vol>
26
- <vol>
27
- <qVol>2</qVol>
28
- <esp>VOLUMES 2</esp>
29
- <marca>DIVERSOS 2</marca>
30
- <nVol>2</nVol>
31
- <pesoL>2000.000</pesoL>
32
- <pesoB>2200.000</pesoB>
33
- </vol>
34
- <vol>
35
- <qVol>3</qVol>
36
- <esp>VOLUMES 3</esp>
37
- <marca>DIVERSOS 3</marca>
38
- <nVol>3</nVol>
39
- <pesoL>3000.000</pesoL>
40
- <pesoB>3300.000</pesoB>
41
- </vol>
42
- </transp>
43
- </infNFe>
44
- </NFe>
45
- eos
14
+ <<~XML
15
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
+ <transp>
18
+ <vol>
19
+ <qVol>1</qVol>
20
+ <esp>VOLUMES 1</esp>
21
+ <marca>DIVERSOS 1</marca>
22
+ <nVol>1</nVol>
23
+ <pesoL>1000.000</pesoL>
24
+ <pesoB>1100.000</pesoB>
25
+ </vol>
26
+ <vol>
27
+ <qVol>2</qVol>
28
+ <esp>VOLUMES 2</esp>
29
+ <marca>DIVERSOS 2</marca>
30
+ <nVol>2</nVol>
31
+ <pesoL>2000.000</pesoL>
32
+ <pesoB>2200.000</pesoB>
33
+ </vol>
34
+ <vol>
35
+ <qVol>3</qVol>
36
+ <esp>VOLUMES 3</esp>
37
+ <marca>DIVERSOS 3</marca>
38
+ <nVol>3</nVol>
39
+ <pesoL>3000.000</pesoL>
40
+ <pesoB>3300.000</pesoB>
41
+ </vol>
42
+ </transp>
43
+ </infNFe>
44
+ </NFe>
45
+ XML
46
46
  end
47
47
 
48
48
  before do
@@ -64,14 +64,14 @@ describe BrDanfe::DanfeLib::NfeLib::Vol do
64
64
 
65
65
  context 'when any <vol> tag is found' do
66
66
  let(:xml_as_string) do
67
- <<-eos
68
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
69
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
70
- <transp>
71
- </transp>
72
- </infNFe>
73
- </NFe>
74
- eos
67
+ <<~XML
68
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
69
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
70
+ <transp>
71
+ </transp>
72
+ </infNFe>
73
+ </NFe>
74
+ XML
75
75
  end
76
76
 
77
77
  it 'renders blank boxes' do
@@ -4,19 +4,19 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
4
4
  describe '#render' do
5
5
  context 'when has FCI' do
6
6
  let(:xml_fci) do
7
- xml = <<-eos
8
- <det nItem="1">
9
- <prod>
10
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
11
- <nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
12
- </prod>
13
- </det>
14
- eos
7
+ xml = <<~XML
8
+ <det nItem="1">
9
+ <prod>
10
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
11
+ <nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
12
+ </prod>
13
+ </det>
14
+ XML
15
15
 
16
16
  Nokogiri::XML(xml)
17
17
  end
18
18
 
19
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_fci) }
19
+ subject { described_class.new(xml_fci) }
20
20
 
21
21
  it 'returns product + FCI' do
22
22
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -32,7 +32,7 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
32
32
  let(:pST) { 0.00 }
33
33
  let(:vICMSSTRet) { 0.00 }
34
34
  let(:xml) do
35
- xml = <<-eos
35
+ xml = <<~XML
36
36
  <det nItem="1">
37
37
  <prod>
38
38
  <xProd>MONITOR DE ARCO ELETRICO</xProd>
@@ -61,12 +61,12 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
61
61
  </COFINS>
62
62
  </imposto>
63
63
  </det>
64
- eos
64
+ XML
65
65
 
66
66
  Nokogiri::XML(xml)
67
67
  end
68
68
 
69
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml) }
69
+ subject { described_class.new(xml) }
70
70
 
71
71
  context 'when has vBCSTRet' do
72
72
  let(:vBCSTRet) { 50.00 }
@@ -115,29 +115,29 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
115
115
 
116
116
  context "when isn't Retido" do
117
117
  let(:xml_st) do
118
- xml = <<-eos
119
- <det nItem="1">
120
- <prod>
121
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
122
- </prod>
123
- <imposto>
124
- <vTotTrib>96.73</vTotTrib>
125
- <ICMS>
126
- <ICMSSN202>
127
- <pMVAST>56.00</pMVAST>
128
- <vBCST>479.82</vBCST>
129
- <pICMSST>17.00</pICMSST>
130
- <vICMSST>29.28</vICMSST>
131
- </ICMSSN202>
132
- </ICMS>
133
- </imposto>
134
- </det>
135
- eos
118
+ xml = <<~XML
119
+ <det nItem="1">
120
+ <prod>
121
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
122
+ </prod>
123
+ <imposto>
124
+ <vTotTrib>96.73</vTotTrib>
125
+ <ICMS>
126
+ <ICMSSN202>
127
+ <pMVAST>56.00</pMVAST>
128
+ <vBCST>479.82</vBCST>
129
+ <pICMSST>17.00</pICMSST>
130
+ <vICMSST>29.28</vICMSST>
131
+ </ICMSSN202>
132
+ </ICMS>
133
+ </imposto>
134
+ </det>
135
+ XML
136
136
 
137
137
  Nokogiri::XML(xml)
138
138
  end
139
139
 
140
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_st) }
140
+ subject { described_class.new(xml_st) }
141
141
 
142
142
  it 'returns product + ST' do
143
143
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -151,19 +151,19 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
151
151
 
152
152
  context 'when has infAdProd' do
153
153
  let(:xml_infAdProd) do
154
- xml = <<-eos
155
- <det nItem="1">
156
- <prod>
157
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
158
- </prod>
159
- <infAdProd>Informações adicionais do produto</infAdProd>
160
- </det>
161
- eos
154
+ xml = <<~XML
155
+ <det nItem="1">
156
+ <prod>
157
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
158
+ </prod>
159
+ <infAdProd>Informações adicionais do produto</infAdProd>
160
+ </det>
161
+ XML
162
162
 
163
163
  Nokogiri::XML(xml)
164
164
  end
165
165
 
166
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_infAdProd) }
166
+ subject { described_class.new(xml_infAdProd) }
167
167
 
168
168
  it 'returns product + infAdProd' do
169
169
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -176,27 +176,27 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
176
176
 
177
177
  context 'when has FCP on ICMS00 tag' do
178
178
  let(:xml_fcp) do
179
- xml = <<-eos
180
- <det nItem="1">
181
- <prod>
182
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
183
- </prod>
184
- <imposto>
185
- <vTotTrib>23.56</vTotTrib>
186
- <ICMS>
187
- <ICMS00>
188
- <vFCP>4.71</vFCP>
189
- <pFCP>2.00</pFCP>
190
- </ICMS00>
191
- </ICMS>
192
- </imposto>
193
- </det>
194
- eos
179
+ xml = <<~XML
180
+ <det nItem="1">
181
+ <prod>
182
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
183
+ </prod>
184
+ <imposto>
185
+ <vTotTrib>23.56</vTotTrib>
186
+ <ICMS>
187
+ <ICMS00>
188
+ <vFCP>4.71</vFCP>
189
+ <pFCP>2.00</pFCP>
190
+ </ICMS00>
191
+ </ICMS>
192
+ </imposto>
193
+ </det>
194
+ XML
195
195
 
196
196
  Nokogiri::XML(xml)
197
197
  end
198
198
 
199
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_fcp) }
199
+ subject { described_class.new(xml_fcp) }
200
200
 
201
201
  it 'returns product + FCP' do
202
202
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -209,35 +209,35 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
209
209
 
210
210
  context 'when has FCI + ST + infAdProd + FCP' do
211
211
  let(:xml_IFC_ST_infAdProd) do
212
- xml = <<-eos
213
- <det nItem="1">
214
- <prod>
215
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
216
- <nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
217
- </prod>
218
- <imposto>
219
- <vTotTrib>96.73</vTotTrib>
220
- <ICMS>
221
- <ICMSSN202>
222
- <pMVAST>56.00</pMVAST>
223
- <vBCST>479.82</vBCST>
224
- <pICMSST>17.00</pICMSST>
225
- <vICMSST>29.28</vICMSST>
226
- </ICMSSN202>
227
- <ICMS00>
228
- <vFCP>4.71</vFCP>
229
- <pFCP>2.00</pFCP>
230
- </ICMS00>
231
- </ICMS>
232
- </imposto>
233
- <infAdProd>Informações adicionais do produto</infAdProd>
234
- </det>
235
- eos
212
+ xml = <<~XML
213
+ <det nItem="1">
214
+ <prod>
215
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
216
+ <nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
217
+ </prod>
218
+ <imposto>
219
+ <vTotTrib>96.73</vTotTrib>
220
+ <ICMS>
221
+ <ICMSSN202>
222
+ <pMVAST>56.00</pMVAST>
223
+ <vBCST>479.82</vBCST>
224
+ <pICMSST>17.00</pICMSST>
225
+ <vICMSST>29.28</vICMSST>
226
+ </ICMSSN202>
227
+ <ICMS00>
228
+ <vFCP>4.71</vFCP>
229
+ <pFCP>2.00</pFCP>
230
+ </ICMS00>
231
+ </ICMS>
232
+ </imposto>
233
+ <infAdProd>Informações adicionais do produto</infAdProd>
234
+ </det>
235
+ XML
236
236
 
237
237
  Nokogiri::XML(xml)
238
238
  end
239
239
 
240
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_IFC_ST_infAdProd) }
240
+ subject { described_class.new(xml_IFC_ST_infAdProd) }
241
241
 
242
242
  it 'returns product + FCI + ST + infAdProd' do
243
243
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -256,28 +256,28 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
256
256
 
257
257
  context 'when FCP is not in a ICMS00 tag' do
258
258
  let(:xml_fcp) do
259
- xml = <<-eos
260
- <det nItem="1">
261
- <prod>
262
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
263
- </prod>
264
- <imposto>
265
- <vTotTrib>23.56</vTotTrib>
266
- <ICMS>
267
- <ICMS10>
268
- <vBCFCP>235.50</vBCFCP>
269
- <vFCP>4.71</vFCP>
270
- <pFCP>2.00</pFCP>
271
- </ICMS10>
272
- </ICMS>
273
- </imposto>
274
- </det>
275
- eos
259
+ xml = <<~XML
260
+ <det nItem="1">
261
+ <prod>
262
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
263
+ </prod>
264
+ <imposto>
265
+ <vTotTrib>23.56</vTotTrib>
266
+ <ICMS>
267
+ <ICMS10>
268
+ <vBCFCP>235.50</vBCFCP>
269
+ <vFCP>4.71</vFCP>
270
+ <pFCP>2.00</pFCP>
271
+ </ICMS10>
272
+ </ICMS>
273
+ </imposto>
274
+ </det>
275
+ XML
276
276
 
277
277
  Nokogiri::XML(xml)
278
278
  end
279
279
 
280
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_fcp) }
280
+ subject { described_class.new(xml_fcp) }
281
281
 
282
282
  it 'returns product + FCP' do
283
283
  expected = 'MONITOR DE ARCO ELETRICO'
@@ -290,28 +290,28 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
290
290
 
291
291
  context 'when has FCP ST' do
292
292
  let(:xml_fcp) do
293
- xml = <<-eos
294
- <det nItem="1">
295
- <prod>
296
- <xProd>MONITOR DE ARCO ELETRICO</xProd>
297
- </prod>
298
- <imposto>
299
- <vTotTrib>23.56</vTotTrib>
300
- <ICMS>
301
- <ICMS30>
302
- <vBCFCPST>235.50</vBCFCPST>
303
- <vFCPST>0.71</vFCPST>
304
- <pFCPST>2.00</pFCPST>
305
- </ICMS30>
306
- </ICMS>
307
- </imposto>
308
- </det>
309
- eos
293
+ xml = <<~XML
294
+ <det nItem="1">
295
+ <prod>
296
+ <xProd>MONITOR DE ARCO ELETRICO</xProd>
297
+ </prod>
298
+ <imposto>
299
+ <vTotTrib>23.56</vTotTrib>
300
+ <ICMS>
301
+ <ICMS30>
302
+ <vBCFCPST>235.50</vBCFCPST>
303
+ <vFCPST>0.71</vFCPST>
304
+ <pFCPST>2.00</pFCPST>
305
+ </ICMS30>
306
+ </ICMS>
307
+ </imposto>
308
+ </det>
309
+ XML
310
310
 
311
311
  Nokogiri::XML(xml)
312
312
  end
313
313
 
314
- subject { BrDanfe::DanfeLib::NfeLib::Xprod.new(xml_fcp) }
314
+ subject { described_class.new(xml_fcp) }
315
315
 
316
316
  it 'returns product + FCP' do
317
317
  expected = 'MONITOR DE ARCO ELETRICO'