br_danfe 0.11.1 → 0.11.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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -0
  3. data/.rubocop.yml +113 -0
  4. data/Gemfile.lock +40 -19
  5. data/Rakefile +3 -3
  6. data/br_danfe.gemspec +7 -7
  7. data/lib/br_danfe.rb +14 -14
  8. data/lib/br_danfe/cce.rb +1 -0
  9. data/lib/br_danfe/cce_lib/barcode.rb +3 -2
  10. data/lib/br_danfe/cce_lib/correction.rb +3 -2
  11. data/lib/br_danfe/cce_lib/document.rb +15 -5
  12. data/lib/br_danfe/cce_lib/footer.rb +1 -1
  13. data/lib/br_danfe/cce_lib/header.rb +1 -1
  14. data/lib/br_danfe/cce_lib/nfe_key.rb +4 -3
  15. data/lib/br_danfe/cce_lib/protocol.rb +4 -3
  16. data/lib/br_danfe/danfe.rb +17 -17
  17. data/lib/br_danfe/danfe_lib/cep.rb +1 -1
  18. data/lib/br_danfe/danfe_lib/cst.rb +8 -6
  19. data/lib/br_danfe/danfe_lib/dest.rb +21 -23
  20. data/lib/br_danfe/danfe_lib/det_body.rb +20 -20
  21. data/lib/br_danfe/danfe_lib/document.rb +49 -36
  22. data/lib/br_danfe/danfe_lib/dup.rb +11 -10
  23. data/lib/br_danfe/danfe_lib/emit_header.rb +38 -34
  24. data/lib/br_danfe/danfe_lib/helper.rb +23 -23
  25. data/lib/br_danfe/danfe_lib/icmstot.rb +12 -12
  26. data/lib/br_danfe/danfe_lib/infadic.rb +1 -0
  27. data/lib/br_danfe/danfe_lib/issqn.rb +6 -6
  28. data/lib/br_danfe/danfe_lib/options.rb +6 -5
  29. data/lib/br_danfe/danfe_lib/phone.rb +2 -2
  30. data/lib/br_danfe/danfe_lib/ticket.rb +6 -4
  31. data/lib/br_danfe/danfe_lib/transp.rb +27 -26
  32. data/lib/br_danfe/danfe_lib/vol.rb +9 -8
  33. data/lib/br_danfe/danfe_lib/xml.rb +6 -6
  34. data/lib/br_danfe/danfe_lib/xprod.rb +22 -23
  35. data/lib/br_danfe/uf.rb +1 -4
  36. data/lib/br_danfe/version.rb +1 -1
  37. data/spec/features/cce_spec.rb +6 -6
  38. data/spec/features/danfe_spec.rb +25 -25
  39. data/spec/fixtures/cce/lib/barcode#render.pdf +5 -1
  40. data/spec/fixtures/cce/lib/correction#render.pdf +6 -2
  41. data/spec/fixtures/cce/lib/document#box.pdf +5 -1
  42. data/spec/fixtures/cce/lib/document#box.with.block.pdf +6 -2
  43. data/spec/fixtures/cce/lib/document#text.align.pdf +6 -2
  44. data/spec/fixtures/cce/lib/document#text.pad.pdf +6 -2
  45. data/spec/fixtures/cce/lib/document#text.simple.pdf +6 -2
  46. data/spec/fixtures/cce/lib/document#text.size.pdf +6 -2
  47. data/spec/fixtures/cce/lib/document#text.style.pdf +6 -2
  48. data/spec/fixtures/cce/lib/footer#render.pdf +6 -2
  49. data/spec/fixtures/cce/lib/header#render.pdf +6 -2
  50. data/spec/fixtures/cce/lib/nfe_key#render.pdf +7 -3
  51. data/spec/fixtures/cce/lib/protocol#render.pdf +7 -3
  52. data/spec/fixtures/cce/v1.00/cce.fixture.pdf +7 -3
  53. data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +7 -3
  54. data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +7 -3
  55. data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +7 -3
  56. data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +7 -3
  57. data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +7 -3
  58. data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +7 -3
  59. data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +7 -3
  60. data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +7 -3
  61. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +383 -379
  62. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +233 -229
  63. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +158 -154
  64. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +158 -154
  65. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +158 -154
  66. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +3697 -3685
  67. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +3540 -3532
  68. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +158 -154
  69. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +158 -154
  70. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +1665 -1657
  71. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +1665 -1657
  72. data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +6 -2
  73. data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +6 -2
  74. data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +6 -2
  75. data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +6 -2
  76. data/spec/fixtures/nfe/lib/document#lie-blank.pdf +6 -2
  77. data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +6 -2
  78. data/spec/fixtures/nfe/lib/document#lie-valid.pdf +6 -2
  79. data/spec/fixtures/nfe/lib/dup#render.pdf +8 -4
  80. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +9 -5
  81. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +9 -5
  82. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +7 -3
  83. data/spec/fixtures/nfe/lib/icmstot#render.pdf +7 -3
  84. data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +8 -4
  85. data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +7 -3
  86. data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +8 -4
  87. data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +7 -3
  88. data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +7 -3
  89. data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +7 -3
  90. data/spec/fixtures/nfe/lib/infadic#render.pdf +7 -3
  91. data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +7 -3
  92. data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +7 -3
  93. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +7 -3
  94. data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +5 -1
  95. data/spec/fixtures/nfe/lib/ticket#render.pdf +6 -2
  96. data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +7 -3
  97. data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +7 -3
  98. data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +7 -3
  99. data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +7 -3
  100. data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +7 -3
  101. data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +7 -3
  102. data/spec/fixtures/nfe/lib/transp#render.pdf +7 -3
  103. data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +6 -2
  104. data/spec/fixtures/nfe/lib/vol#render.pdf +6 -2
  105. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +317 -313
  106. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +315 -311
  107. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +1297 -1289
  108. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +165 -161
  109. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +1297 -1289
  110. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +314 -310
  111. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +765 -761
  112. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +1222 -1214
  113. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +1222 -1214
  114. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +4004 -3992
  115. data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +1522 -1514
  116. data/spec/lib/cce_lib/barcode_spec.rb +5 -5
  117. data/spec/lib/cce_lib/correction_spec.rb +5 -5
  118. data/spec/lib/cce_lib/document_spec.rb +23 -23
  119. data/spec/lib/cce_lib/footer_spec.rb +4 -4
  120. data/spec/lib/cce_lib/header_spec.rb +4 -4
  121. data/spec/lib/cce_lib/nfe_key_spec.rb +5 -5
  122. data/spec/lib/cce_lib/protocol_spec.rb +5 -5
  123. data/spec/lib/danfe_lib/cep_spec.rb +5 -5
  124. data/spec/lib/danfe_lib/cst_spec.rb +8 -8
  125. data/spec/lib/danfe_lib/dest_spec.rb +23 -23
  126. data/spec/lib/danfe_lib/det_body_spec.rb +26 -26
  127. data/spec/lib/danfe_lib/document_spec.rb +25 -25
  128. data/spec/lib/danfe_lib/dup_spec.rb +4 -4
  129. data/spec/lib/danfe_lib/emit_header_spec.rb +13 -13
  130. data/spec/lib/danfe_lib/helper_spec.rb +74 -74
  131. data/spec/lib/danfe_lib/icmstot_spec.rb +4 -4
  132. data/spec/lib/danfe_lib/infadic_spec.rb +6 -13
  133. data/spec/lib/danfe_lib/infadic_vol_spec.rb +1 -4
  134. data/spec/lib/danfe_lib/issqn_spec.rb +11 -11
  135. data/spec/lib/danfe_lib/logo_options_spec.rb +18 -18
  136. data/spec/lib/danfe_lib/options_spec.rb +7 -7
  137. data/spec/lib/danfe_lib/phone_spec.rb +10 -10
  138. data/spec/lib/danfe_lib/plate_spec.rb +9 -9
  139. data/spec/lib/danfe_lib/ticket_spec.rb +4 -4
  140. data/spec/lib/danfe_lib/transp_spec.rb +10 -10
  141. data/spec/lib/danfe_lib/vol_spec.rb +7 -7
  142. data/spec/lib/danfe_lib/xml_spec.rb +5 -5
  143. data/spec/lib/danfe_lib/xprod_spec.rb +48 -50
  144. data/spec/lib/uf_spec.rb +12 -12
  145. data/spec/support/have_same_content_of.rb +6 -6
  146. metadata +40 -10
@@ -1,21 +1,21 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Barcode do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
- let(:xml) { File.read("./spec/fixtures/cce/v1.00/cce.xml") }
8
+ let(:xml) { File.read('./spec/fixtures/cce/v1.00/cce.xml') }
9
9
 
10
10
  subject { described_class.new(pdf, xml) }
11
11
 
12
- describe "#render" do
12
+ describe '#render' do
13
13
  before do
14
14
  subject.render
15
15
  File.delete(output_pdf) if File.exist?(output_pdf)
16
16
  end
17
17
 
18
- it "renders header to the pdf" do
18
+ it 'renders header to the pdf' do
19
19
  expect(File.exist?(output_pdf)).to be_falsey
20
20
 
21
21
  pdf.render_file output_pdf
@@ -1,21 +1,21 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Correction do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
- let(:xml) { File.read("./spec/fixtures/cce/v1.00/cce.xml") }
8
+ let(:xml) { File.read('./spec/fixtures/cce/v1.00/cce.xml') }
9
9
 
10
10
  subject { described_class.new(pdf, xml) }
11
11
 
12
- describe "#render" do
12
+ describe '#render' do
13
13
  before do
14
14
  subject.render
15
15
  File.delete(output_pdf) if File.exist?(output_pdf)
16
16
  end
17
17
 
18
- it "renders header to the pdf" do
18
+ it 'renders header to the pdf' do
19
19
  expect(File.exist?(output_pdf)).to be_falsey
20
20
 
21
21
  pdf.render_file output_pdf
@@ -1,17 +1,17 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Document do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- describe "#box" do
7
+ describe '#box' do
8
8
  context "when a block isn't passed" do
9
9
  before do
10
10
  File.delete(output_pdf) if File.exist?(output_pdf)
11
11
  subject.box(height: 50)
12
12
  end
13
13
 
14
- it "renders box with the page width" do
14
+ it 'renders box with the page width' do
15
15
  expect(File.exist?(output_pdf)).to be_falsey
16
16
 
17
17
  subject.render_file output_pdf
@@ -20,13 +20,13 @@ describe BrDanfe::CceLib::Document do
20
20
  end
21
21
  end
22
22
 
23
- context "when a block is passed" do
23
+ context 'when a block is passed' do
24
24
  before do
25
25
  File.delete(output_pdf) if File.exist?(output_pdf)
26
- subject.box(height: 50) { subject.text "sample text" }
26
+ subject.box(height: 50) { subject.text 'sample text' }
27
27
  end
28
28
 
29
- it "renders box with the block" do
29
+ it 'renders box with the block' do
30
30
  expect(File.exist?(output_pdf)).to be_falsey
31
31
 
32
32
  subject.render_file output_pdf
@@ -36,14 +36,14 @@ describe BrDanfe::CceLib::Document do
36
36
  end
37
37
  end
38
38
 
39
- describe "#text" do
40
- context "when is a simple text" do
39
+ describe '#text' do
40
+ context 'when is a simple text' do
41
41
  before do
42
42
  File.delete(output_pdf) if File.exist?(output_pdf)
43
- subject.text "simple text"
43
+ subject.text 'simple text'
44
44
  end
45
45
 
46
- it "renders the text" do
46
+ it 'renders the text' do
47
47
  expect(File.exist?(output_pdf)).to be_falsey
48
48
 
49
49
  subject.render_file output_pdf
@@ -52,13 +52,13 @@ describe BrDanfe::CceLib::Document do
52
52
  end
53
53
  end
54
54
 
55
- context "when is a text with style" do
55
+ context 'when is a text with style' do
56
56
  before do
57
57
  File.delete(output_pdf) if File.exist?(output_pdf)
58
- subject.text "bold text", style: :bold
58
+ subject.text 'bold text', style: :bold
59
59
  end
60
60
 
61
- it "renders the text" do
61
+ it 'renders the text' do
62
62
  expect(File.exist?(output_pdf)).to be_falsey
63
63
 
64
64
  subject.render_file output_pdf
@@ -67,13 +67,13 @@ describe BrDanfe::CceLib::Document do
67
67
  end
68
68
  end
69
69
 
70
- context "when is a text with size" do
70
+ context 'when is a text with size' do
71
71
  before do
72
72
  File.delete(output_pdf) if File.exist?(output_pdf)
73
- subject.text "big text", size: 25
73
+ subject.text 'big text', size: 25
74
74
  end
75
75
 
76
- it "renders the text" do
76
+ it 'renders the text' do
77
77
  expect(File.exist?(output_pdf)).to be_falsey
78
78
 
79
79
  subject.render_file output_pdf
@@ -82,13 +82,13 @@ describe BrDanfe::CceLib::Document do
82
82
  end
83
83
  end
84
84
 
85
- context "when is a text with pad" do
85
+ context 'when is a text with pad' do
86
86
  before do
87
87
  File.delete(output_pdf) if File.exist?(output_pdf)
88
- subject.text "text with pad", pad: 50
88
+ subject.text 'text with pad', pad: 50
89
89
  end
90
90
 
91
- it "renders the text" do
91
+ it 'renders the text' do
92
92
  expect(File.exist?(output_pdf)).to be_falsey
93
93
 
94
94
  subject.render_file output_pdf
@@ -97,13 +97,13 @@ describe BrDanfe::CceLib::Document do
97
97
  end
98
98
  end
99
99
 
100
- context "when is a text with align" do
100
+ context 'when is a text with align' do
101
101
  before do
102
102
  File.delete(output_pdf) if File.exist?(output_pdf)
103
- subject.text "text in center", align: :center
103
+ subject.text 'text in center', align: :center
104
104
  end
105
105
 
106
- it "renders the text" do
106
+ it 'renders the text' do
107
107
  expect(File.exist?(output_pdf)).to be_falsey
108
108
 
109
109
  subject.render_file output_pdf
@@ -1,20 +1,20 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Footer do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
8
 
9
9
  subject { described_class.new(pdf) }
10
10
 
11
- describe "#render" do
11
+ describe '#render' do
12
12
  before do
13
13
  subject.render
14
14
  File.delete(output_pdf) if File.exist?(output_pdf)
15
15
  end
16
16
 
17
- it "renders header to the pdf" do
17
+ it 'renders header to the pdf' do
18
18
  expect(File.exist?(output_pdf)).to be_falsey
19
19
 
20
20
  pdf.render_file output_pdf
@@ -1,20 +1,20 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Header do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
8
 
9
9
  subject { described_class.new(pdf) }
10
10
 
11
- describe "#render" do
11
+ describe '#render' do
12
12
  before do
13
13
  subject.render
14
14
  File.delete(output_pdf) if File.exist?(output_pdf)
15
15
  end
16
16
 
17
- it "renders header to the pdf" do
17
+ it 'renders header to the pdf' do
18
18
  expect(File.exist?(output_pdf)).to be_falsey
19
19
 
20
20
  pdf.render_file output_pdf
@@ -1,21 +1,21 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::NfeKey do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
- let(:xml) { File.read("./spec/fixtures/cce/v1.00/cce.xml") }
8
+ let(:xml) { File.read('./spec/fixtures/cce/v1.00/cce.xml') }
9
9
 
10
10
  subject { described_class.new(pdf, xml) }
11
11
 
12
- describe "#render" do
12
+ describe '#render' do
13
13
  before do
14
14
  subject.render
15
15
  File.delete(output_pdf) if File.exist?(output_pdf)
16
16
  end
17
17
 
18
- it "renders header to the pdf" do
18
+ it 'renders header to the pdf' do
19
19
  expect(File.exist?(output_pdf)).to be_falsey
20
20
 
21
21
  pdf.render_file output_pdf
@@ -1,21 +1,21 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::CceLib::Protocol do
4
- let(:base_dir) { "./spec/fixtures/cce/lib/"}
4
+ let(:base_dir) { './spec/fixtures/cce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
7
  let(:pdf) { BrDanfe::CceLib::Document.new }
8
- let(:xml) { File.read("./spec/fixtures/cce/v1.00/cce.xml") }
8
+ let(:xml) { File.read('./spec/fixtures/cce/v1.00/cce.xml') }
9
9
 
10
10
  subject { described_class.new(pdf, xml) }
11
11
 
12
- describe "#render" do
12
+ describe '#render' do
13
13
  before do
14
14
  subject.render
15
15
  File.delete(output_pdf) if File.exist?(output_pdf)
16
16
  end
17
17
 
18
- it "renders header to the pdf" do
18
+ it 'renders header to the pdf' do
19
19
  expect(File.exist?(output_pdf)).to be_falsey
20
20
 
21
21
  pdf.render_file output_pdf
@@ -1,10 +1,10 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::DanfeLib::Cep do
4
- describe ".format" do
5
- it "returns a formated CEP" do
6
- cep = "12345678"
7
- expect(BrDanfe::DanfeLib::Cep.format(cep)).to eq "12.345-678"
4
+ describe '.format' do
5
+ it 'returns a formated CEP' do
6
+ cep = '12345678'
7
+ expect(BrDanfe::DanfeLib::Cep.format(cep)).to eq '12.345-678'
8
8
  end
9
9
  end
10
10
  end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::DanfeLib::Cst do
4
4
  let(:xml_cst) do
@@ -35,16 +35,16 @@ describe BrDanfe::DanfeLib::Cst do
35
35
  Nokogiri::XML(xml)
36
36
  end
37
37
 
38
- describe ".to_danfe" do
39
- context "when CST" do
40
- it "returns origin + CST" do
41
- expect(BrDanfe::DanfeLib::Cst.to_danfe(xml_cst)).to eq "500"
38
+ describe '.to_danfe' do
39
+ context 'when CST' do
40
+ it 'returns origin + CST' do
41
+ expect(BrDanfe::DanfeLib::Cst.to_danfe(xml_cst)).to eq '500'
42
42
  end
43
43
  end
44
44
 
45
- context "when CSOSN" do
46
- it "returns origin + CSOSN" do
47
- expect(BrDanfe::DanfeLib::Cst.to_danfe(xml_csosn)).to eq "4102"
45
+ context 'when CSOSN' do
46
+ it 'returns origin + CSOSN' do
47
+ expect(BrDanfe::DanfeLib::Cst.to_danfe(xml_csosn)).to eq '4102'
48
48
  end
49
49
  end
50
50
  end
@@ -1,14 +1,14 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::DanfeLib::Dest do
4
- let(:path_of_expected_pdf) { "./spec/fixtures/nfe/lib/output.pdf" }
4
+ let(:path_of_expected_pdf) { './spec/fixtures/nfe/lib/output.pdf' }
5
5
 
6
6
  let(:pdf) { BrDanfe::DanfeLib::Document.new }
7
7
  let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
8
8
 
9
9
  subject { described_class.new(pdf, xml) }
10
10
 
11
- describe "#render" do
11
+ describe '#render' do
12
12
  before do
13
13
  File.delete(path_of_expected_pdf) if File.exist?(path_of_expected_pdf)
14
14
  subject.render
@@ -47,12 +47,12 @@ describe BrDanfe::DanfeLib::Dest do
47
47
  eos
48
48
  end
49
49
 
50
- it "renders xml to the pdf" do
50
+ it 'renders xml to the pdf' do
51
51
  expect(File.exist?(path_of_expected_pdf)).to eql false
52
52
 
53
53
  pdf.render_file path_of_expected_pdf
54
54
 
55
- expect("./spec/fixtures/nfe/lib/dest#render-v2.00.pdf").to have_same_content_of file: path_of_expected_pdf
55
+ expect('./spec/fixtures/nfe/lib/dest#render-v2.00.pdf').to have_same_content_of file: path_of_expected_pdf
56
56
  end
57
57
  end
58
58
 
@@ -88,12 +88,12 @@ describe BrDanfe::DanfeLib::Dest do
88
88
  eos
89
89
  end
90
90
 
91
- it "renders xml to the pdf" do
91
+ it 'renders xml to the pdf' do
92
92
  expect(File.exist?(path_of_expected_pdf)).to eql false
93
93
 
94
94
  pdf.render_file path_of_expected_pdf
95
95
 
96
- expect("./spec/fixtures/nfe/lib/dest#render-v3.10.pdf").to have_same_content_of file: path_of_expected_pdf
96
+ expect('./spec/fixtures/nfe/lib/dest#render-v3.10.pdf').to have_same_content_of file: path_of_expected_pdf
97
97
  end
98
98
  end
99
99
 
@@ -129,16 +129,16 @@ describe BrDanfe::DanfeLib::Dest do
129
129
  eos
130
130
  end
131
131
 
132
- it "renders xml to the pdf" do
132
+ it 'renders xml to the pdf' do
133
133
  expect(File.exist?(path_of_expected_pdf)).to eql false
134
134
 
135
135
  pdf.render_file path_of_expected_pdf
136
136
 
137
- expect("./spec/fixtures/nfe/lib/dest#render-v4.00.pdf").to have_same_content_of file: path_of_expected_pdf
137
+ expect('./spec/fixtures/nfe/lib/dest#render-v4.00.pdf').to have_same_content_of file: path_of_expected_pdf
138
138
  end
139
139
  end
140
140
 
141
- context "when recipient has CNPJ" do
141
+ context 'when recipient has CNPJ' do
142
142
  let(:xml_as_string) do
143
143
  <<-eos
144
144
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
@@ -151,16 +151,16 @@ describe BrDanfe::DanfeLib::Dest do
151
151
  eos
152
152
  end
153
153
 
154
- it "renders xml to the pdf" do
154
+ it 'renders xml to the pdf' do
155
155
  expect(File.exist?(path_of_expected_pdf)).to eql false
156
156
 
157
157
  pdf.render_file path_of_expected_pdf
158
158
 
159
- expect("./spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf").to have_same_content_of file: path_of_expected_pdf
159
+ expect('./spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf').to have_same_content_of file: path_of_expected_pdf
160
160
  end
161
161
  end
162
162
 
163
- context "when recipient has CPF" do
163
+ context 'when recipient has CPF' do
164
164
  let(:xml_as_string) do
165
165
  <<-eos
166
166
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
@@ -173,16 +173,16 @@ describe BrDanfe::DanfeLib::Dest do
173
173
  eos
174
174
  end
175
175
 
176
- it "renders xml to the pdf" do
176
+ it 'renders xml to the pdf' do
177
177
  expect(File.exist?(path_of_expected_pdf)).to eql false
178
178
 
179
179
  pdf.render_file path_of_expected_pdf
180
180
 
181
- expect("./spec/fixtures/nfe/lib/dest#render-with_cpf.pdf").to have_same_content_of file: path_of_expected_pdf
181
+ expect('./spec/fixtures/nfe/lib/dest#render-with_cpf.pdf').to have_same_content_of file: path_of_expected_pdf
182
182
  end
183
183
  end
184
184
 
185
- context "when recipient has IE" do
185
+ context 'when recipient has IE' do
186
186
  let(:xml_as_string) do
187
187
  <<-eos
188
188
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
@@ -198,12 +198,12 @@ describe BrDanfe::DanfeLib::Dest do
198
198
  eos
199
199
  end
200
200
 
201
- it "renders xml to the pdf" do
201
+ it 'renders xml to the pdf' do
202
202
  expect(File.exist?(path_of_expected_pdf)).to eql false
203
203
 
204
204
  pdf.render_file path_of_expected_pdf
205
205
 
206
- expect("./spec/fixtures/nfe/lib/dest#render-with_ie.pdf").to have_same_content_of file: path_of_expected_pdf
206
+ expect('./spec/fixtures/nfe/lib/dest#render-with_ie.pdf').to have_same_content_of file: path_of_expected_pdf
207
207
  end
208
208
  end
209
209
 
@@ -238,17 +238,17 @@ describe BrDanfe::DanfeLib::Dest do
238
238
  eos
239
239
  end
240
240
 
241
- it "renders xml to the pdf" do
241
+ it 'renders xml to the pdf' do
242
242
  expect(File.exist?(path_of_expected_pdf)).to eql false
243
243
 
244
244
  pdf.render_file path_of_expected_pdf
245
245
 
246
- expect("./spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf")
246
+ expect('./spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf')
247
247
  .to have_same_content_of file: path_of_expected_pdf
248
248
  end
249
249
  end
250
250
 
251
- context "when recipient address (xLgr + nro + xCpl) has more than 63 characters" do
251
+ context 'when recipient address (xLgr + nro + xCpl) has more than 63 characters' do
252
252
  let(:xml_as_string) do
253
253
  <<-eos
254
254
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
@@ -280,12 +280,12 @@ describe BrDanfe::DanfeLib::Dest do
280
280
  eos
281
281
  end
282
282
 
283
- it "renders xml to pdf discarding the address of after 63 characters" do
283
+ it 'renders xml to pdf discarding the address of after 63 characters' do
284
284
  expect(File.exist?(path_of_expected_pdf)).to eql false
285
285
 
286
286
  pdf.render_file path_of_expected_pdf
287
287
 
288
- expect("./spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf")
288
+ expect('./spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf')
289
289
  .to have_same_content_of file: path_of_expected_pdf
290
290
  end
291
291
  end