dorsale 2.4.3 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/dorsale/billing_machine/invoice.rb +1 -1
- data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +46 -42
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +216 -158
- data/app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb +4 -3
- data/config/locales/billing_machine.en.yml +57 -62
- data/config/locales/billing_machine.fr.yml +57 -62
- data/config/locales/common.en.yml +0 -14
- data/config/locales/common.fr.yml +0 -15
- data/config/locales/{en.yml → dorsale.en.yml} +0 -0
- data/config/locales/{fr.yml → dorsale.fr.yml} +0 -0
- data/lib/dorsale/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +215 -0
- data/spec/dummy/log/test.log +5626 -0
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +10 -1
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +16 -215
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +10 -1
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +17 -212
- metadata +4 -4
@@ -29,9 +29,18 @@ describe ::Dorsale::BillingMachine::InvoiceMultipleVatPdf, pdfs: true do
|
|
29
29
|
}
|
30
30
|
|
31
31
|
it "should not display global vat rate" do
|
32
|
-
expect(content).to_not include "TVA 19,60
|
32
|
+
expect(content).to_not include "TVA 19,60 %"
|
33
33
|
expect(content).to include "MONTANT TVA"
|
34
34
|
expect(content).to include "TVA %"
|
35
35
|
end
|
36
36
|
|
37
|
+
it "should work with empty invoice" do
|
38
|
+
id_card = Dorsale::BillingMachine::IdCard.new
|
39
|
+
invoice = ::Dorsale::BillingMachine::Invoice.new(id_card: id_card)
|
40
|
+
|
41
|
+
expect {
|
42
|
+
invoice.pdf.render
|
43
|
+
}.to_not raise_error
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
@@ -5,60 +5,15 @@ describe ::Dorsale::BillingMachine::InvoiceSingleVatPdf, pdfs: true do
|
|
5
5
|
::Dorsale::BillingMachine.vat_mode = :single
|
6
6
|
end
|
7
7
|
|
8
|
-
let(:customer) {
|
9
|
-
create(:customer_vault_corporation)
|
10
|
-
}
|
11
|
-
|
12
|
-
let(:id_card) { create(:billing_machine_id_card,
|
13
|
-
entity_name: "HEYHO",
|
14
|
-
registration_city: 'RCS MARSEILLE',
|
15
|
-
registration_number: '000 000 000',
|
16
|
-
siret: '000 000 000 00000',
|
17
|
-
ape_naf: '0000A',
|
18
|
-
legal_form: 'SARL',
|
19
|
-
capital: 1_000_000_000,
|
20
|
-
intracommunity_vat: 'FR 00 000 000 000 000 00',
|
21
|
-
address1: '42 Avenue de Ruby', zip: '13004',
|
22
|
-
city: 'Marseille',
|
23
|
-
contact_full_name: 'Jane Doe',
|
24
|
-
contact_phone: '+33.6.00.00.00.00',
|
25
|
-
contact_fax: '+33.9.00.00.00.00',
|
26
|
-
contact_email: 'email@example.org',
|
27
|
-
iban: 'FR76 0000 0000 0000 0000 0000 000',
|
28
|
-
bic_swift: 'PSSTTHEGAME',
|
29
|
-
custom_info_1: "Tout retard de règlement donnera lieu de plein droit et sans qu’aucune mise en demeure ne soit nécessaire au paiement de " +
|
30
|
-
'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de ' +
|
31
|
-
'recouvrement d’un montant de 999999€'
|
32
|
-
) }
|
33
|
-
|
34
8
|
let(:invoice) {
|
35
|
-
|
36
|
-
i = create(:billing_machine_invoice,
|
37
|
-
date: '16/04/2014',
|
38
|
-
id_card: id_card,
|
39
|
-
customer: customer,
|
40
|
-
commercial_discount: 100.23,
|
41
|
-
advance: 1.79,
|
42
|
-
)
|
9
|
+
i = create(:billing_machine_invoice)
|
43
10
|
|
44
11
|
create(:billing_machine_invoice_line,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
unit_price: 2.54,
|
49
|
-
vat_rate: 19.6,
|
50
|
-
total: 7.98)
|
51
|
-
|
52
|
-
create(:billing_machine_invoice_line,
|
53
|
-
invoice: i,
|
54
|
-
label: 'Truc',
|
55
|
-
quantity: 42.42,
|
56
|
-
unit: 'nuts',
|
57
|
-
unit_price: 42.54,
|
58
|
-
vat_rate: 19.6,
|
59
|
-
total: 1804.55)
|
12
|
+
:invoice => i,
|
13
|
+
:vat_rate => 19.6,
|
14
|
+
)
|
60
15
|
|
61
|
-
i
|
16
|
+
i
|
62
17
|
}
|
63
18
|
|
64
19
|
let(:pdf) {
|
@@ -71,174 +26,20 @@ describe ::Dorsale::BillingMachine::InvoiceSingleVatPdf, pdfs: true do
|
|
71
26
|
tempfile.write(pdf.render)
|
72
27
|
tempfile.flush
|
73
28
|
Yomu.new(tempfile.path).text
|
74
|
-
|
75
|
-
|
76
|
-
describe "#initialize" do
|
77
|
-
it 'inherits from Prawn::Document' do
|
78
|
-
expect(pdf).to be_kind_of(Prawn::Document)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should assign @main_document' do
|
82
|
-
expect(pdf.main_document).to eq invoice
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'when the id card is empty' do
|
87
|
-
let(:id_card) {
|
88
|
-
::Dorsale::BillingMachine::IdCard.create(id_card_name: 'default')
|
89
|
-
}
|
90
|
-
it 'should not crash' do
|
91
|
-
pdf.build
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'Id card informations' do
|
96
|
-
it 'is expected to print the right information' do
|
97
|
-
expect(content).to include 'HEYHO'
|
98
|
-
expect(content).to include 'SIRET 000 000 000 00000 '
|
99
|
-
expect(content).to include 'SARL au capital de 1.000.000.000 €'
|
100
|
-
expect(content).to include 'RCS MARSEILLE 000 000 000'
|
101
|
-
expect(content).to include 'TVA FR 00 000 000 000 000 00'
|
102
|
-
expect(content).to include '42 Avenue de Ruby'
|
103
|
-
expect(content).to include '13004 Marseille'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe 'Header' do
|
108
|
-
it "should write invoice tracking id" do
|
109
|
-
expect(content).to include 'Facture'
|
110
|
-
expect(content).to include 'n°'
|
111
|
-
expect(content).to include invoice.tracking_id
|
112
|
-
end
|
113
|
-
|
114
|
-
it "is expected to print invoice date" do
|
115
|
-
expect(content).to include 'Date : ' + '16/04/2014'
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'is expected to print contact informations' do
|
119
|
-
expect(content).to include 'Jane Doe'
|
120
|
-
expect(content).to include 'Téléphone :'
|
121
|
-
expect(content).to include ' +33.6.00.00.00.00'
|
122
|
-
expect(content).to include 'Fax :'
|
123
|
-
expect(content).to include ' +33.9.00.00.00.00'
|
124
|
-
expect(content).to include 'Email :'
|
125
|
-
expect(content).to include ' email@example.org'
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe 'customer information' do
|
130
|
-
it "should write customer name" do
|
131
|
-
expect(content).to include invoice.customer.name
|
132
|
-
end
|
133
|
-
|
134
|
-
it "is expected to print customer address" do
|
135
|
-
expect(content).to include invoice.customer.address.street
|
136
|
-
expect(content).to include invoice.customer.address.street_bis
|
137
|
-
end
|
138
|
-
|
139
|
-
it "is expected to print customer zip and city" do
|
140
|
-
expect(content).to include invoice.customer.address.zip.to_s +
|
141
|
-
' ' + invoice.customer.address.city.to_s
|
142
|
-
end
|
143
|
-
|
144
|
-
it "is expected to print 'Objet :' and invoice label" do
|
145
|
-
expect(content).to include 'Objet : '
|
146
|
-
expect(content).to include invoice.label
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe "product table" do
|
151
|
-
it "is expected to print the header" do
|
152
|
-
expect(content).to include 'DÉSIGNATION'
|
153
|
-
expect(content).to include 'QTITÉ'
|
154
|
-
expect(content).to include 'UNITÉ'
|
155
|
-
expect(content).to include 'P.U €HT'
|
156
|
-
expect(content).to include 'TOTAL €HT'
|
157
|
-
end
|
158
|
-
it 'is expected to print invoice line label of each invoice line' do
|
159
|
-
invoice.lines.each do |line|
|
160
|
-
expect(content).to include line.label
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'is expected to print invoice line quantity of each line' do
|
165
|
-
expect(content).to include '3,14'
|
166
|
-
expect(content).to include '42,42'
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'is expected to print invoice line unit_price of each line' do
|
170
|
-
expect(content).to include '2,54 €'.gsub(" ", "\u00A0")
|
171
|
-
expect(content).to include '42,54 €'.gsub(" ", "\u00A0")
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'is expected to print invoice line total of each line' do
|
175
|
-
expect(content).to include '7,98 €'.gsub(" ", "\u00A0")
|
176
|
-
expect(content).to include '1 804,55 €'.gsub(" ", "\u00A0")
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe 'Total table' do
|
181
|
-
it 'is expected to print all the invoice synthesis' do
|
182
|
-
expect(content).to include 'REMISE'
|
183
|
-
expect(content).to include '- '+'100,23 €'.gsub(" ", "\u00A0")
|
184
|
-
expect(content).to include 'TOTAL HT'
|
185
|
-
expect(content).to include '1 712,29 €'.gsub(" ", "\u00A0")
|
186
|
-
expect(content).to include 'TVA 19,60 %'
|
187
|
-
expect(content).to include '335,61 €'.gsub(" ", "\u00A0")
|
188
|
-
expect(content).to include 'ACOMPTE'
|
189
|
-
expect(content).to include '1,79 €'.gsub(" ", "\u00A0")
|
190
|
-
expect(content).to include 'TOTAL TTC'
|
191
|
-
expect(content).to include '2 046,11 €'.gsub(" ", "\u00A0")
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
|
196
|
-
describe 'Footer' do
|
197
|
-
it 'is expected to print invoice payment term' do
|
198
|
-
expect(content).to include 'Conditions de paiement :'
|
199
|
-
expect(content).to include invoice.payment_term.label
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'is expected to print current and total page number' do
|
203
|
-
expect(content).to include 'page 1/1'
|
204
|
-
end
|
29
|
+
}
|
205
30
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
expect(content).to include 'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de'
|
211
|
-
expect(content).to include 'recouvrement d’un montant de 999999€'
|
212
|
-
end
|
31
|
+
it "should display global vat rate" do
|
32
|
+
expect(content).to include "TVA 19,60 %"
|
33
|
+
expect(content).to_not include "MONTANT TVA"
|
34
|
+
expect(content).to_not include "TVA %"
|
213
35
|
end
|
214
36
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
advance: 0,
|
219
|
-
customer: customer,
|
220
|
-
date: '2014-04-16',
|
221
|
-
id_card: id_card,
|
222
|
-
)
|
223
|
-
pdf_incomplete = invoice_incomplete.pdf
|
224
|
-
pdf_incomplete.build
|
225
|
-
tempfile = Tempfile.new("pdf")
|
226
|
-
tempfile.binmode
|
227
|
-
tempfile.write(pdf_incomplete.render)
|
228
|
-
tempfile.flush
|
229
|
-
@incomplete_content = Yomu.new(tempfile.path).text
|
230
|
-
end
|
231
|
-
|
232
|
-
it 'is expected not to print ACOMPTE' do
|
233
|
-
expect(@incomplete_content).to_not include 'ACOMPTE'
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'is expected not to print REMISE' do
|
237
|
-
expect(@incomplete_content).to_not include 'REMISE'
|
238
|
-
end
|
37
|
+
it "should work with empty invoice" do
|
38
|
+
id_card = Dorsale::BillingMachine::IdCard.new
|
39
|
+
invoice = ::Dorsale::BillingMachine::Invoice.new(id_card: id_card)
|
239
40
|
|
240
|
-
|
241
|
-
|
242
|
-
|
41
|
+
expect {
|
42
|
+
invoice.pdf.render
|
43
|
+
}.to_not raise_error
|
243
44
|
end
|
244
45
|
end
|
@@ -29,9 +29,18 @@ describe ::Dorsale::BillingMachine::QuotationMultipleVatPdf, pdfs: true do
|
|
29
29
|
}
|
30
30
|
|
31
31
|
it "should not display global vat rate" do
|
32
|
-
expect(content).to_not include "TVA 19,60
|
32
|
+
expect(content).to_not include "TVA 19,60 %"
|
33
33
|
expect(content).to include "MONTANT TVA"
|
34
34
|
expect(content).to include "TVA %"
|
35
35
|
end
|
36
36
|
|
37
|
+
it "should work with empty quotation" do
|
38
|
+
id_card = Dorsale::BillingMachine::IdCard.new
|
39
|
+
quotation = ::Dorsale::BillingMachine::Quotation.new(id_card: id_card)
|
40
|
+
|
41
|
+
expect {
|
42
|
+
quotation.pdf.render
|
43
|
+
}.to_not raise_error
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
@@ -5,59 +5,15 @@ describe ::Dorsale::BillingMachine::QuotationSingleVatPdf, pdfs: true do
|
|
5
5
|
::Dorsale::BillingMachine.vat_mode = :single
|
6
6
|
end
|
7
7
|
|
8
|
-
let(:customer) {
|
9
|
-
create(:customer_vault_corporation)
|
10
|
-
}
|
11
|
-
|
12
|
-
let(:id_card) { create(:billing_machine_id_card,
|
13
|
-
entity_name: "HEYHO",
|
14
|
-
registration_city: 'RCS MARSEILLE',
|
15
|
-
registration_number: '000 000 000',
|
16
|
-
siret: '000 000 000 00000',
|
17
|
-
ape_naf: '0000A',
|
18
|
-
legal_form: 'SARL',
|
19
|
-
capital: 1_000_000_000,
|
20
|
-
intracommunity_vat: 'FR 00 000 000 000 000 00',
|
21
|
-
address1: '42 Avenue de Ruby', zip: '13004',
|
22
|
-
city: 'Marseille',
|
23
|
-
contact_full_name: 'Jane Doe',
|
24
|
-
contact_phone: '+33.6.00.00.00.00',
|
25
|
-
contact_fax: '+33.9.00.00.00.00',
|
26
|
-
contact_email: 'email@example.org',
|
27
|
-
iban: 'FR76 0000 0000 0000 0000 0000 000',
|
28
|
-
bic_swift: 'PSSTTHEGAME',
|
29
|
-
custom_info_1: "Tout retard de règlement donnera lieu de plein droit et sans qu’aucune mise en demeure ne soit nécessaire au paiement de " +
|
30
|
-
'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de ' +
|
31
|
-
'recouvrement d’un montant de 999999€'
|
32
|
-
) }
|
33
|
-
|
34
8
|
let(:quotation) {
|
35
|
-
|
36
|
-
q = create(:billing_machine_quotation,
|
37
|
-
date: '16/04/2014',
|
38
|
-
id_card: id_card,
|
39
|
-
customer: customer,
|
40
|
-
commercial_discount: 100.23,
|
41
|
-
comments: 'this is the quotation comment')
|
9
|
+
q = create(:billing_machine_quotation)
|
42
10
|
|
43
11
|
create(:billing_machine_quotation_line,
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
unit_price: 2.54,
|
48
|
-
vat_rate: 19.6,
|
49
|
-
total: 7.98)
|
12
|
+
:quotation => q,
|
13
|
+
:vat_rate => 19.6,
|
14
|
+
)
|
50
15
|
|
51
|
-
|
52
|
-
quotation: q,
|
53
|
-
label: 'Truc',
|
54
|
-
quantity: 42.42,
|
55
|
-
unit: 'nuts',
|
56
|
-
unit_price: 42.54,
|
57
|
-
vat_rate: 19.6,
|
58
|
-
total: 1804.55)
|
59
|
-
|
60
|
-
q.reload
|
16
|
+
q
|
61
17
|
}
|
62
18
|
|
63
19
|
let(:pdf) {
|
@@ -70,173 +26,21 @@ describe ::Dorsale::BillingMachine::QuotationSingleVatPdf, pdfs: true do
|
|
70
26
|
tempfile.write(pdf.render)
|
71
27
|
tempfile.flush
|
72
28
|
Yomu.new(tempfile.path).text
|
73
|
-
|
74
|
-
|
75
|
-
describe "#initialize" do
|
76
|
-
it 'inherits from Prawn::Document' do
|
77
|
-
expect(pdf).to be_kind_of(Prawn::Document)
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'should assign @main_document' do
|
81
|
-
expect(pdf.main_document).to eq quotation
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'when the id card is empty' do
|
86
|
-
let(:id_card) {
|
87
|
-
::Dorsale::BillingMachine::IdCard.create(id_card_name: 'default')
|
88
|
-
}
|
89
|
-
it 'should not crash' do
|
90
|
-
pdf.build
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe 'Id card informations' do
|
95
|
-
it 'is expected to print the right information' do
|
96
|
-
expect(content).to include 'HEYHO'
|
97
|
-
expect(content).to include 'SIRET 000 000 000 00000 '
|
98
|
-
expect(content).to include 'SARL au capital de 1.000.000.000 €'
|
99
|
-
expect(content).to include 'RCS MARSEILLE 000 000 000'
|
100
|
-
expect(content).to include 'TVA FR 00 000 000 000 000 00'
|
101
|
-
expect(content).to include '42 Avenue de Ruby'
|
102
|
-
expect(content).to include '13004 Marseille'
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe 'Header' do
|
107
|
-
it "should write invoice tracking id" do
|
108
|
-
expect(content).to include 'Devis'
|
109
|
-
expect(content).to include 'n°'
|
110
|
-
expect(content).to include quotation.tracking_id
|
111
|
-
end
|
112
|
-
|
113
|
-
it "is expected to print invoice date" do
|
114
|
-
expect(content).to include 'Date : ' + '16/04/2014'
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'is expected to print contact informations' do
|
118
|
-
expect(content).to include 'Jane Doe'
|
119
|
-
expect(content).to include 'Téléphone :'
|
120
|
-
expect(content).to include ' +33.6.00.00.00.00'
|
121
|
-
expect(content).to include 'Fax :'
|
122
|
-
expect(content).to include ' +33.9.00.00.00.00'
|
123
|
-
expect(content).to include 'Email :'
|
124
|
-
expect(content).to include ' email@example.org'
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe 'customer information' do
|
129
|
-
it "should write customer name" do
|
130
|
-
expect(content).to include quotation.customer.name
|
131
|
-
end
|
132
|
-
|
133
|
-
it "is expected to print customer address" do
|
134
|
-
expect(content).to include quotation.customer.address.street
|
135
|
-
expect(content).to include quotation.customer.address.street_bis
|
136
|
-
end
|
137
|
-
|
138
|
-
it "is expected to print customer zip and city" do
|
139
|
-
expect(content).to include quotation.customer.address.zip.to_s +
|
140
|
-
' ' + quotation.customer.address.city.to_s
|
141
|
-
end
|
142
|
-
|
143
|
-
it "is expected to print 'Objet :' and invoice label" do
|
144
|
-
expect(content).to include 'Objet : '
|
145
|
-
expect(content).to include quotation.label
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe "product table" do
|
150
|
-
it "is expected to print the header" do
|
151
|
-
expect(content).to include 'DÉSIGNATION'
|
152
|
-
expect(content).to include 'QTITÉ'
|
153
|
-
expect(content).to include 'UNITÉ'
|
154
|
-
expect(content).to include 'P.U €HT'
|
155
|
-
expect(content).to include 'TOTAL €HT'
|
156
|
-
end
|
157
|
-
it 'is expected to print invoice line label of each invoice line' do
|
158
|
-
quotation.lines.each do |line|
|
159
|
-
expect(content).to include line.label
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'is expected to print invoice line quantity of each line' do
|
164
|
-
expect(content).to include '3,14'
|
165
|
-
expect(content).to include '42,42'
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'is expected to print invoice line unit_price of each line' do
|
169
|
-
expect(content).to include '2,54 €'.gsub(" ", "\u00A0")
|
170
|
-
expect(content).to include '42,54 €'.gsub(" ", "\u00A0")
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'is expected to print invoice line total of each line' do
|
174
|
-
expect(content).to include '7,98 €'.gsub(" ", "\u00A0")
|
175
|
-
expect(content).to include '1 804,55 €'.gsub(" ", "\u00A0")
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
describe 'Total table' do
|
180
|
-
it 'is expected to print all the invoice synthesis' do
|
181
|
-
expect(content).to include 'REMISE'
|
182
|
-
expect(content).to include '- '+'100,23 €'.gsub(" ", "\u00A0")
|
183
|
-
expect(content).to include 'TOTAL HT'
|
184
|
-
expect(content).to include '1 712,29 €'.gsub(" ", "\u00A0")
|
185
|
-
expect(content).to include 'TVA 19,60 %'
|
186
|
-
expect(content).to include '335,61 €'.gsub(" ", "\u00A0")
|
187
|
-
expect(content).to_not include 'ACOMPTE'
|
188
|
-
expect(content).to include 'TOTAL TTC'
|
189
|
-
expect(content).to include '2 047,90 €'.gsub(" ", "\u00A0")
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
|
194
|
-
describe 'Footer' do
|
195
|
-
it 'is expected to print invoice payment term' do
|
196
|
-
expect(content).to include 'Conditions de paiement :'
|
197
|
-
expect(content).to include quotation.payment_term.label
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'is expected to print current and total page number' do
|
201
|
-
expect(content).to include 'page 1/1'
|
202
|
-
end
|
203
|
-
|
204
|
-
it 'is expected to print current and total page number' do
|
205
|
-
expect(content).to include quotation.comments
|
206
|
-
end
|
29
|
+
}
|
207
30
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
expect(content).to include 'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de'
|
213
|
-
expect(content).to include 'recouvrement d’un montant de 999999€'
|
214
|
-
end
|
31
|
+
it "should display global vat rate" do
|
32
|
+
expect(content).to include "TVA 19,60 %"
|
33
|
+
expect(content).to_not include "MONTANT TVA"
|
34
|
+
expect(content).to_not include "TVA %"
|
215
35
|
end
|
216
36
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
pdf_incomplete = quotation_incomplete.pdf
|
221
|
-
pdf_incomplete.build
|
222
|
-
tempfile = Tempfile.new("pdf")
|
223
|
-
tempfile.binmode
|
224
|
-
tempfile.write(pdf_incomplete.render)
|
225
|
-
tempfile.flush
|
226
|
-
@incomplete_content = Yomu.new(tempfile.path).text
|
227
|
-
end
|
228
|
-
|
229
|
-
it 'is expected not to print ACOMPTE' do
|
230
|
-
expect(@incomplete_content).to_not include 'ACOMPTE'
|
231
|
-
end
|
37
|
+
it "should work with empty quotation" do
|
38
|
+
id_card = Dorsale::BillingMachine::IdCard.new
|
39
|
+
quotation = ::Dorsale::BillingMachine::Quotation.new(id_card: id_card)
|
232
40
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
it 'is expected to print TOTAL TTC' do
|
238
|
-
expect(@incomplete_content).to include 'TOTAL TTC'
|
239
|
-
end
|
41
|
+
expect {
|
42
|
+
quotation.pdf.render
|
43
|
+
}.to_not raise_error
|
240
44
|
end
|
241
45
|
|
242
46
|
describe "attachment" do
|
@@ -251,6 +55,7 @@ describe ::Dorsale::BillingMachine::QuotationSingleVatPdf, pdfs: true do
|
|
251
55
|
expect(text).to include "page 2"
|
252
56
|
end
|
253
57
|
end
|
58
|
+
|
254
59
|
end
|
255
60
|
|
256
61
|
|