br_danfe 0.20.0 → 1.0.0

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/config/locales/pt-BR.yml +15 -0
  5. data/lib/br_danfe/danfe_lib/nfe.rb +5 -3
  6. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +1 -1
  7. data/lib/br_danfe/danfe_lib/nfe_lib/det_body.rb +6 -1
  8. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +8 -4
  9. data/lib/br_danfe/danfe_lib/nfe_lib/entrega.rb +86 -0
  10. data/lib/br_danfe/danfe_lib/nfe_lib/helper.rb +4 -4
  11. data/lib/br_danfe/danfe_lib/nfe_lib/icmstot.rb +8 -4
  12. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +3 -19
  13. data/lib/br_danfe/danfe_lib/nfe_lib/issqn.rb +4 -2
  14. data/lib/br_danfe/danfe_lib/nfe_lib/transp.rb +8 -4
  15. data/lib/br_danfe/danfe_lib/nfe_lib/vol.rb +6 -2
  16. data/lib/br_danfe/version.rb +1 -1
  17. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +73 -0
  18. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +50 -0
  19. data/spec/br_danfe/danfe_lib/nfe_lib/entrega_spec.rb +186 -0
  20. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +23 -4
  21. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +46 -0
  22. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +0 -41
  23. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +49 -0
  24. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +49 -0
  25. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +59 -0
  26. data/spec/br_danfe/danfe_lib/nfe_spec.rb +11 -0
  27. data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +1110 -0
  28. data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
  29. data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
  30. data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
  31. data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
  32. data/spec/fixtures/nfe/lib/entrega#render-without-address-complement.pdf +0 -0
  33. data/spec/fixtures/nfe/lib/icmstot#render-with_entrega.pdf +0 -0
  34. data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
  35. data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
  36. data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
  37. data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
  38. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml +260 -0
  39. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +3413 -0
  40. metadata +20 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b147ffdc115abf1fbddafd9b9e150fa28a8a679591b99bb587d69144ed87be98
4
- data.tar.gz: dafa613951bdd04c7d144f9d2062e1c869e4eb383bd287dd297628d48693621c
3
+ metadata.gz: 345273bdb39c1d133110285def88a0dcae14df47b6e1b8fcd6085ab753d3898e
4
+ data.tar.gz: 2d24c830171df9dd03b4870e96704385a809d240ae7abcb3b4c0adc31673a2dd
5
5
  SHA512:
6
- metadata.gz: 13334799087d11a4a521c2cca04cc0c7253b9c8a8afa17e8fc04f896cad46099a4740154bd485062ac57ad57ac40ef7dff60b57c0f0674d5eb62789d1d054ed1
7
- data.tar.gz: 3613638cbad5891190114473ff1b51696e736b11e56f34b3662398d1952fe3c9aa73c7a5a66a1674543426386f5af40865200be60640fff6d6e48891eb2ba30b
6
+ metadata.gz: '08340f8602de112ea5260412165d3481f7a1122074093f30e505afacda6fbbdab1ccd43fdddffc606c60b546311ff89f92d08f20abc204832f33e95f702364fd'
7
+ data.tar.gz: 9ad4f2ed6707f8b4d486f4f8d78fb1cb4d251ae0b2b867c4cb760050343a491633ec5b59751d469e7eb7189feff096fd33e65f04a93afc334fdf64778ef3d9ee
data/.codeclimate.yml CHANGED
@@ -14,7 +14,7 @@ engines:
14
14
  enabled: true
15
15
  rubocop:
16
16
  enabled: true
17
- channel: rubocop-0-67-0
17
+ channel: rubocop-0-92
18
18
  ratings:
19
19
  paths:
20
20
  - Gemfile.lock
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (0.20.0)
4
+ br_danfe (1.0.0)
5
5
  barby (= 0.6.9)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
@@ -144,6 +144,21 @@ pt-BR:
144
144
  received_at: "DATA DE RECEBIMENTO"
145
145
  receiver: "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"
146
146
  document: "NF-e\nN°. %{nNF}\nSÉRIE %{serie}"
147
+ entrega:
148
+ title: "INFORMAÇÕES DO LOCAL DE ENTREGA"
149
+ CNPJ: "CNPJ"
150
+ CPF: "CPF"
151
+ xNome: "NOME/RAZÃO SOCIAL"
152
+ xLgr: "ENDEREÇO"
153
+ nro: "NÚMERO"
154
+ xCpl: "COMPLEMENTO"
155
+ xBairro: "BAIRRO"
156
+ cMun: "CÓDIGO DE MUNICÍPIO"
157
+ xMun: "MUNICÍPIO"
158
+ UF: "UF"
159
+ CEP: "CEP"
160
+ fone: "FONE/FAX"
161
+ IE: "INSCRIÇÃO ESTADUAL"
147
162
  nfce:
148
163
  payment_methods:
149
164
  '01': "Dinheiro"
@@ -42,6 +42,7 @@ module BrDanfe
42
42
  def render_on_first_page(xml)
43
43
  NfeLib::Ticket.new(@document, xml).render
44
44
  NfeLib::Dest.new(@document, xml).render
45
+ NfeLib::Entrega.new(@document, xml).render
45
46
  NfeLib::Dup.new(@document, xml).render
46
47
  NfeLib::Icmstot.new(@document, xml).render
47
48
  NfeLib::Transp.new(@document, xml).render
@@ -73,13 +74,14 @@ module BrDanfe
73
74
  @document.go_to_page(page)
74
75
 
75
76
  emitter.render(initial_page_of_pdf, y_position, total_pages)
76
- render_product_table_title initial_page_of_pdf
77
+ render_product_table_title initial_page_of_pdf, xml
77
78
  render_footer_information footer_info
78
79
  render_no_fiscal_value(xml)
79
80
  end
80
81
 
81
- def render_product_table_title(page)
82
- y_position = page == 1 ? 18.91 : 7.40
82
+ def render_product_table_title(page, xml)
83
+ y_position = NfeLib::Entrega.delivery_local?(xml) && page == 1 ? 3.00 : 0
84
+ y_position += page == 1 ? 18.91 : 7.40
83
85
  @document.ititle 0.42, 10.00, 0.75, y_position, 'det.title'
84
86
  end
85
87
 
@@ -53,7 +53,7 @@ module BrDanfe
53
53
  end
54
54
 
55
55
  def address
56
- address = Helper.generate_address @xml
56
+ address = Helper.generate_address @xml, 'enderDest'
57
57
 
58
58
  if Helper.address_is_too_big(@pdf, address)
59
59
  address = address[0..address.length - 2] while Helper.mensure_text(@pdf, "#{address.strip}...") > MAXIMUM_SIZE_FOR_STREET && !address.empty?
@@ -2,9 +2,13 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class DetBody
5
+ attr_reader :y_position_with_entrega
6
+
5
7
  def initialize(pdf, xml)
6
8
  @pdf = pdf
7
9
  @xml = xml
10
+
11
+ @y_position_with_entrega = Entrega.delivery_local?(@xml) ? 3.00 : 0.00
8
12
  end
9
13
 
10
14
  def render(has_issqn)
@@ -121,7 +125,8 @@ module BrDanfe
121
125
  end
122
126
 
123
127
  def table_position_on_first_page
124
- Helper.invert(18.07.cm)
128
+ y_position = @y_position_with_entrega.cm + 18.07.cm
129
+ Helper.invert(y_position)
125
130
  end
126
131
 
127
132
  def table_position_on_next_pages
@@ -2,21 +2,25 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class Dup
5
- Y = 12.92
5
+ attr_reader :y_position
6
+
7
+ Y_POSITION = 12.92
6
8
 
7
9
  def initialize(pdf, xml)
8
10
  @pdf = pdf
9
11
  @xml = xml
10
12
 
11
- @ltitle = Y - 0.42
13
+ @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION
14
+
15
+ @ltitle = @y_position - 0.42
12
16
  end
13
17
 
14
18
  def render
15
19
  @pdf.ititle 0.42, 10.00, 0.75, @ltitle, 'dup.title'
16
- @pdf.ibox 0.85, 19.57, 0.75, Y
20
+ @pdf.ibox 0.85, 19.57, 0.75, @y_position
17
21
 
18
22
  x = 0.75
19
- y = Y
23
+ y = @y_position
20
24
  @xml.collect('xmlns', 'dup') do |det|
21
25
  render_dup(det, x, y)
22
26
  x += 2.30
@@ -0,0 +1,86 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Entrega
5
+ Y_POSITION = 12.92
6
+ MAXIMUM_SIZE_FOR_STREET = 319
7
+
8
+ def initialize(pdf, xml)
9
+ @pdf = pdf
10
+ @xml = xml
11
+
12
+ @y_position = Y_POSITION
13
+ @ltitle = @y_position - 0.42
14
+ @l1 = @y_position
15
+ @l2 = @y_position + LINE_HEIGHT
16
+ @l3 = @y_position + (LINE_HEIGHT * 2)
17
+ end
18
+
19
+ def render
20
+ if Entrega.delivery_local?(@xml)
21
+ @pdf.ititle 0.42, 10.00, 0.75, @ltitle, 'entrega.title'
22
+ render_line1
23
+ render_line2
24
+ render_line3
25
+ end
26
+ end
27
+
28
+ def self.delivery_local?(xml)
29
+ doc = xml.is_a?(BrDanfe::XML) ? xml : Nokogiri::XML(xml)
30
+ doc.css('entrega/xLgr').text.present?
31
+ end
32
+
33
+ private
34
+
35
+ def render_line1
36
+ @pdf.lbox LINE_HEIGHT, 11.82, 0.75, @l1, @xml, 'entrega/xNome'
37
+ render_cnpj_cpf
38
+ @pdf.lie LINE_HEIGHT, 2.92, 17.40, @l1, @xml, 'entrega/UF', 'entrega/IE'
39
+ end
40
+
41
+ def render_cnpj_cpf
42
+ if @xml['entrega/CNPJ'] == ''
43
+ @pdf.i18n_lbox LINE_HEIGHT, 4.37, 12.57, @l1, 'entrega.CPF', cpf
44
+ else
45
+ @pdf.lcnpj LINE_HEIGHT, 4.37, 12.57, @l1, @xml, 'entrega/CNPJ'
46
+ end
47
+ end
48
+
49
+ def cpf
50
+ cpf = BrDocuments::CnpjCpf::Cpf.new(@xml['entrega/CPF'])
51
+ cpf.formatted
52
+ end
53
+
54
+ def render_line2
55
+ @pdf.i18n_lbox LINE_HEIGHT, 11.82, 0.75, @l2, 'entrega.xLgr', address
56
+ @pdf.lbox LINE_HEIGHT, 4.37, 12.57, @l2, @xml, 'entrega/xBairro'
57
+ @pdf.i18n_lbox LINE_HEIGHT, 2.92, 17.40, @l2, 'entrega.CEP', cep
58
+ end
59
+
60
+ def address
61
+ address = Helper.generate_address @xml, 'entrega'
62
+
63
+ if Helper.address_is_too_big(@pdf, address)
64
+ address = address[0..address.length - 2] while Helper.mensure_text(@pdf, "#{address.strip}...") > MAXIMUM_SIZE_FOR_STREET && !address.empty?
65
+ address = "#{address.strip}..."
66
+ end
67
+ address
68
+ end
69
+
70
+ def cep
71
+ BrDanfe::Helper.format_cep(@xml['entrega/CEP'])
72
+ end
73
+
74
+ def render_line3
75
+ @pdf.lbox LINE_HEIGHT, 15.05, 0.75, @l3, @xml, 'entrega/xMun'
76
+ @pdf.lbox LINE_HEIGHT, 1.14, 15.8, @l3, @xml, 'entrega/UF'
77
+ @pdf.i18n_lbox LINE_HEIGHT, 2.92, 17.40, @l3, 'entrega.fone', phone
78
+ end
79
+
80
+ def phone
81
+ Phone.format(@xml['entrega/fone'])
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -38,10 +38,10 @@ module BrDanfe
38
38
  Helper.mensure_text(pdf, address) > Dest::MAXIMUM_SIZE_FOR_STREET
39
39
  end
40
40
 
41
- def self.generate_address(xml)
42
- address_complement = " - #{xml_text(xml, 'enderDest/xCpl')}" if xml_text(xml, 'enderDest/xCpl').present?
43
- address_number = " #{xml_text(xml, 'enderDest/nro')}" if xml_text(xml, 'enderDest/nro').present?
44
- "#{xml_text(xml, 'enderDest/xLgr')}#{address_number}#{address_complement}"
41
+ def self.generate_address(xml, path)
42
+ address_complement = " - #{xml_text(xml, "#{path}/xCpl")}" if xml_text(xml, "#{path}/xCpl").present?
43
+ address_number = " #{xml_text(xml, "#{path}/nro")}" if xml_text(xml, "#{path}/nro").present?
44
+ "#{xml_text(xml, "#{path}/xLgr")}#{address_number}#{address_complement}"
45
45
  end
46
46
 
47
47
  def self.xml_text(xml, property)
@@ -2,15 +2,19 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class Icmstot
5
- Y = 13.77 + SPACE_BETWEEN_GROUPS
5
+ attr_reader :y_position
6
+
7
+ Y_POSITION = 13.77 + SPACE_BETWEEN_GROUPS
6
8
 
7
9
  def initialize(pdf, xml)
8
10
  @pdf = pdf
9
11
  @xml = xml
10
12
 
11
- @ltitle = Y - 0.42
12
- @l1 = Y
13
- @l2 = Y + LINE_HEIGHT
13
+ @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION
14
+
15
+ @ltitle = @y_position - 0.42
16
+ @l1 = @y_position
17
+ @l2 = @y_position + LINE_HEIGHT
14
18
  end
15
19
 
16
20
  def render
@@ -44,7 +44,6 @@ module BrDanfe
44
44
  additional_data.push(address_content) if address?
45
45
  additional_data.push(difal_content) if difal?
46
46
  additional_data.push(fisco_content) if fisco?
47
- additional_data.push(address_shipment) if shipment?
48
47
  additional_data.join(' * ')
49
48
  end
50
49
 
@@ -57,11 +56,11 @@ module BrDanfe
57
56
  end
58
57
 
59
58
  def address_content
60
- "Endereço: #{Helper.generate_address @xml}"
59
+ "Endereço: #{Helper.generate_address @xml, 'enderDest'}"
61
60
  end
62
61
 
63
62
  def address?
64
- Helper.address_is_too_big @pdf, Helper.generate_address(@xml)
63
+ Helper.address_is_too_big @pdf, Helper.generate_address(@xml, 'enderDest')
65
64
  end
66
65
 
67
66
  def difal_content
@@ -77,21 +76,6 @@ module BrDanfe
77
76
  BrDanfe::Helper.numerify(value) if value != ''
78
77
  end
79
78
 
80
- def shipment?
81
- @xml['entrega'].present?
82
- end
83
-
84
- def address_shipment
85
- street = @xml['entrega/xLgr'].to_s
86
- number = @xml['entrega/nro'].to_s
87
- complement = @xml['entrega/xCpl'].to_s
88
- neighborhood = @xml['entrega/xBairro'].to_s
89
- city = @xml['entrega/xMun'].to_s
90
- uf = @xml['entrega/UF'].to_s
91
-
92
- "Endereço de entrega: #{street}, nº #{number} - #{neighborhood} - #{city} - #{uf} - #{complement}"
93
- end
94
-
95
79
  def difal?
96
80
  value = @xml['ICMSTot/vICMSUFDest'].presence || '0.0'
97
81
  BigDecimal(value).positive?
@@ -114,7 +98,7 @@ module BrDanfe
114
98
  end
115
99
 
116
100
  def additional_data?
117
- complementary? || address? || difal? || fisco? || shipment?
101
+ complementary? || address? || difal? || fisco?
118
102
  end
119
103
 
120
104
  def render_reserved_fisco
@@ -2,14 +2,16 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class Issqn
5
+ attr_reader :y_position
6
+
5
7
  Y_POSITION = 25.72 + SPACE_BETWEEN_GROUPS
6
8
 
7
9
  def initialize(pdf, xml)
8
10
  @pdf = pdf
9
11
  @xml = xml
10
12
 
11
- @title = Y_POSITION - 0.42
12
- @y_position = Y_POSITION
13
+ @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION
14
+ @title = @y_position - 0.42
13
15
 
14
16
  @serv = 'total/ISSQNtot/vServ'
15
17
  @bc = 'total/ISSQNtot/vBC'
@@ -2,15 +2,19 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class Transp
5
- Y = 15.89 + SPACE_BETWEEN_GROUPS
5
+ attr_reader :y_position
6
+
7
+ Y_POSITION = 15.89 + SPACE_BETWEEN_GROUPS
6
8
 
7
9
  def initialize(pdf, xml)
8
10
  @pdf = pdf
9
11
  @xml = xml
10
12
 
11
- @ltitle = Y - 0.42
12
- @l1 = Y
13
- @l2 = Y + LINE_HEIGHT
13
+ @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION
14
+
15
+ @ltitle = @y_position - 0.42
16
+ @l1 = @y_position
17
+ @l2 = @y_position + LINE_HEIGHT
14
18
  end
15
19
 
16
20
  def render
@@ -2,13 +2,17 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class Vol
5
- Y = 18.01
5
+ attr_reader :y_position
6
+
7
+ Y_POSITION = 18.01
6
8
 
7
9
  def initialize(pdf, xml)
8
10
  @pdf = pdf
9
11
  @xml = xml
10
12
 
11
- @l1 = Y
13
+ @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION
14
+
15
+ @l1 = @y_position
12
16
  end
13
17
 
14
18
  def render
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '0.20.0'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
@@ -418,6 +418,79 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
418
418
  end
419
419
  end
420
420
 
421
+ context 'with entrega' do
422
+ let(:products) do
423
+ <<~XML
424
+ <det nItem="1">
425
+ <prod>
426
+ <cProd>REF 06</cProd>
427
+ <xProd>Produto com FCI</xProd>
428
+ <NCM>90303329</NCM>
429
+ <EXTIPI>00</EXTIPI>
430
+ <CFOP>5101</cfop>
431
+ <uCom>PC</uCom>
432
+ <qCom>1.00</qCom>
433
+ <vUnCom>49.23</vUnCom>
434
+ <vProd>49.23</vProd>
435
+ </prod>
436
+ <imposto>
437
+ <ICMS>
438
+ <ICMS00>
439
+ <orig>0</orig>
440
+ <CST>00</CST>
441
+ <modBC>3</modBC>
442
+ <vBC>49.23</vBC>
443
+ <pICMS>12.00</pICMS>
444
+ <vICMS>5.90</vICMS>
445
+ </ICMS00>
446
+ </ICMS>
447
+ <IPI>
448
+ <cEnq>999</cEnq>
449
+ <IPITrib>
450
+ <CST>50</CST>
451
+ <vBC>49.23</vBC>
452
+ <pIPI>5.00</pIPI>
453
+ <vIPI>2.46</vIPI>
454
+ </IPITrib>
455
+ </IPI>
456
+ </imposto>
457
+ </det>
458
+ XML
459
+ end
460
+
461
+ let(:xml_as_string) do
462
+ <<~XML
463
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
464
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
465
+ #{products}
466
+ <entrega>
467
+ <CNPJ>82743287000880</CNPJ>
468
+ <xNome>Schneider Electric Brasil Ltda</xNome>
469
+ <xLgr>Av da Saudade</xLgr>
470
+ <nro>1125</nro>
471
+ <xBairro>Frutal</xBairro>
472
+ <xCpl>Sala 01 e 02</xCpl>
473
+ <cMun>3552403</cMun>
474
+ <xMun>SUMARE</xMun>
475
+ <UF>SP</UF>
476
+ <CEP>13171320</CEP>
477
+ <fone>1921046300</fone>
478
+ <IE>671008375110</IE>
479
+ </entrega>
480
+ </infNFe>
481
+ </NFe>
482
+ XML
483
+ end
484
+
485
+ it 'renders xml to the pdf' do
486
+ expect(File.exist?(output_pdf)).to be_falsey
487
+
488
+ pdf.render_file output_pdf
489
+
490
+ expect("#{base_dir}det_body#render-with_entrega.pdf").to have_same_content_of file: output_pdf
491
+ end
492
+ end
493
+
421
494
  context 'when the product table occupies more than one page' do
422
495
  context 'when the product table occupies two pages' do
423
496
  let(:products) { ("#{product_1}\n#{product_2}" * 22) + "\n#{product_1}" }
@@ -48,5 +48,55 @@ describe BrDanfe::DanfeLib::NfeLib::Dup do
48
48
 
49
49
  expect("#{base_dir}dup#render.pdf").to have_same_content_of file: output_pdf
50
50
  end
51
+
52
+ describe 'with entrega' do
53
+ let(:xml_as_string) do
54
+ <<~XML
55
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
56
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
57
+ <cobr>
58
+ <dup>
59
+ <nDup>1</nDup>
60
+ <dVenc>2015-02-13</dVenc>
61
+ <vDup>25.56</vDup>
62
+ </dup>
63
+ <dup>
64
+ <nDup>2</nDup>
65
+ <dVenc>2015-03-15</dVenc>
66
+ <vDup>25.56</vDup>
67
+ </dup>
68
+ <dup>
69
+ <nDup>3</nDup>
70
+ <dVenc>2015-04-14</dVenc>
71
+ <vDup>25.55</vDup>
72
+ </dup>
73
+ </cobr>
74
+ <entrega>
75
+ <CNPJ>82743287000880</CNPJ>
76
+ <xNome>Schneider Electric Brasil Ltda</xNome>
77
+ <xLgr>Av da Saudade</xLgr>
78
+ <nro>1125</nro>
79
+ <xBairro>Frutal</xBairro>
80
+ <xCpl>Sala 01 e 02</xCpl>
81
+ <cMun>3552403</cMun>
82
+ <xMun>SUMARE</xMun>
83
+ <UF>SP</UF>
84
+ <CEP>13171320</CEP>
85
+ <fone>1921046300</fone>
86
+ <IE>671008375110</IE>
87
+ </entrega>
88
+ </infNFe>
89
+ </NFe>
90
+ XML
91
+ end
92
+
93
+ it 'renders xml to the pdf' do
94
+ expect(File.exist?(output_pdf)).to be_falsey
95
+
96
+ pdf.render_file output_pdf
97
+
98
+ expect("#{base_dir}dup#render-with_entrega.pdf").to have_same_content_of file: output_pdf
99
+ end
100
+ end
51
101
  end
52
102
  end