bollettino 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +103 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +31 -3
- data/README.md +8 -8
- data/bollettino.gemspec +10 -7
- data/lib/bollettino.rb +15 -12
- data/lib/bollettino/generator.rb +24 -20
- data/lib/bollettino/model/address.rb +22 -0
- data/lib/bollettino/model/base.rb +9 -0
- data/lib/bollettino/model/payee.rb +21 -0
- data/lib/bollettino/model/payer.rb +20 -0
- data/lib/bollettino/model/payment_order.rb +24 -0
- data/lib/bollettino/model/slip.rb +25 -0
- data/lib/bollettino/renderer/address.rb +32 -0
- data/lib/bollettino/renderer/base.rb +46 -0
- data/lib/bollettino/renderer/errors.rb +14 -0
- data/lib/bollettino/renderer/payee.rb +34 -0
- data/lib/bollettino/renderer/payer.rb +28 -0
- data/lib/bollettino/renderer/payment_order.rb +45 -0
- data/lib/bollettino/renderer/slip.rb +29 -0
- data/lib/bollettino/version.rb +3 -1
- data/spec/integration/generation_spec.rb +8 -9
- data/spec/spec_helper.rb +9 -1
- data/spec/unit/bollettino/generator_spec.rb +8 -35
- data/spec/unit/bollettino/model/address_spec.rb +20 -0
- data/spec/unit/bollettino/model/payee_spec.rb +18 -0
- data/spec/unit/bollettino/model/payer_spec.rb +24 -0
- data/spec/unit/bollettino/model/payment_order_spec.rb +19 -0
- data/spec/unit/bollettino/model/slip_spec.rb +29 -0
- data/spec/unit/bollettino/renderer/address_spec.rb +28 -0
- data/spec/unit/bollettino/renderer/payee_spec.rb +39 -0
- data/spec/unit/bollettino/renderer/payer_spec.rb +41 -0
- data/spec/unit/bollettino/renderer/payment_order_spec.rb +40 -0
- data/spec/unit/bollettino/renderer/slip_spec.rb +54 -0
- metadata +81 -51
- data/lib/bollettino/models/address.rb +0 -18
- data/lib/bollettino/models/payee.rb +0 -17
- data/lib/bollettino/models/payer.rb +0 -16
- data/lib/bollettino/models/payment_order.rb +0 -20
- data/lib/bollettino/models/slip.rb +0 -21
- data/lib/bollettino/renderer.rb +0 -47
- data/lib/bollettino/renderers/address_renderer.rb +0 -24
- data/lib/bollettino/renderers/payee_renderer.rb +0 -26
- data/lib/bollettino/renderers/payer_renderer.rb +0 -20
- data/lib/bollettino/renderers/payment_order_renderer.rb +0 -37
- data/lib/bollettino/renderers/slip_renderer.rb +0 -21
- data/spec/unit/bollettino/models/address_spec.rb +0 -12
- data/spec/unit/bollettino/models/payee_spec.rb +0 -10
- data/spec/unit/bollettino/models/payer_spec.rb +0 -12
- data/spec/unit/bollettino/models/payment_order_spec.rb +0 -11
- data/spec/unit/bollettino/models/slip_spec.rb +0 -15
- data/spec/unit/bollettino/renderers/address_renderer_spec.rb +0 -23
- data/spec/unit/bollettino/renderers/payee_renderer_spec.rb +0 -37
- data/spec/unit/bollettino/renderers/payer_renderer_spec.rb +0 -27
- data/spec/unit/bollettino/renderers/payment_order_renderer_spec.rb +0 -39
- data/spec/unit/bollettino/renderers/slip_renderer_spec.rb +0 -34
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Bollettino::Renderer::PaymentOrderRenderer do
|
4
|
-
subject { described_class }
|
5
|
-
|
6
|
-
describe '.render' do
|
7
|
-
it 'renders the payment_order' do
|
8
|
-
payment_order = stub(
|
9
|
-
text_amount: 'Millecentociquanta/25',
|
10
|
-
numeric_amount: 1150.25,
|
11
|
-
reason: 'Invoce INV-1234'
|
12
|
-
)
|
13
|
-
|
14
|
-
image = stub()
|
15
|
-
|
16
|
-
subject
|
17
|
-
.expects(:write_text)
|
18
|
-
.times(8)
|
19
|
-
|
20
|
-
subject.render image, payment_order
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'when numeric_amount is longer than 7 digits' do
|
24
|
-
it 'raises an error' do
|
25
|
-
payment_order = stub(
|
26
|
-
text_amount: 'Millecentociquanta/25',
|
27
|
-
numeric_amount: 123456.78,
|
28
|
-
reason: 'Invoce INV-1234'
|
29
|
-
)
|
30
|
-
|
31
|
-
image = stub()
|
32
|
-
|
33
|
-
expect {
|
34
|
-
subject.render image, payment_order
|
35
|
-
}.to raise_error(Bollettino::Renderer::RenderingError)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Bollettino::Renderer::SlipRenderer do
|
4
|
-
subject { described_class }
|
5
|
-
|
6
|
-
describe '.render' do
|
7
|
-
it 'renders the slip' do
|
8
|
-
slip = stub(
|
9
|
-
payee: stub(),
|
10
|
-
payer: stub(),
|
11
|
-
payment_order: stub()
|
12
|
-
)
|
13
|
-
|
14
|
-
image = stub()
|
15
|
-
|
16
|
-
Bollettino::Renderer::PayeeRenderer
|
17
|
-
.expects(:render)
|
18
|
-
.with(image, slip.payee)
|
19
|
-
.once
|
20
|
-
|
21
|
-
Bollettino::Renderer::PayerRenderer
|
22
|
-
.expects(:render)
|
23
|
-
.with(image, slip.payer)
|
24
|
-
.once
|
25
|
-
|
26
|
-
Bollettino::Renderer::PaymentOrderRenderer
|
27
|
-
.expects(:render)
|
28
|
-
.with(image, slip.payment_order)
|
29
|
-
.once
|
30
|
-
|
31
|
-
subject.render image, slip
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|