bollettino 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +103 -0
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +31 -3
  5. data/README.md +8 -8
  6. data/bollettino.gemspec +10 -7
  7. data/lib/bollettino.rb +15 -12
  8. data/lib/bollettino/generator.rb +24 -20
  9. data/lib/bollettino/model/address.rb +22 -0
  10. data/lib/bollettino/model/base.rb +9 -0
  11. data/lib/bollettino/model/payee.rb +21 -0
  12. data/lib/bollettino/model/payer.rb +20 -0
  13. data/lib/bollettino/model/payment_order.rb +24 -0
  14. data/lib/bollettino/model/slip.rb +25 -0
  15. data/lib/bollettino/renderer/address.rb +32 -0
  16. data/lib/bollettino/renderer/base.rb +46 -0
  17. data/lib/bollettino/renderer/errors.rb +14 -0
  18. data/lib/bollettino/renderer/payee.rb +34 -0
  19. data/lib/bollettino/renderer/payer.rb +28 -0
  20. data/lib/bollettino/renderer/payment_order.rb +45 -0
  21. data/lib/bollettino/renderer/slip.rb +29 -0
  22. data/lib/bollettino/version.rb +3 -1
  23. data/spec/integration/generation_spec.rb +8 -9
  24. data/spec/spec_helper.rb +9 -1
  25. data/spec/unit/bollettino/generator_spec.rb +8 -35
  26. data/spec/unit/bollettino/model/address_spec.rb +20 -0
  27. data/spec/unit/bollettino/model/payee_spec.rb +18 -0
  28. data/spec/unit/bollettino/model/payer_spec.rb +24 -0
  29. data/spec/unit/bollettino/model/payment_order_spec.rb +19 -0
  30. data/spec/unit/bollettino/model/slip_spec.rb +29 -0
  31. data/spec/unit/bollettino/renderer/address_spec.rb +28 -0
  32. data/spec/unit/bollettino/renderer/payee_spec.rb +39 -0
  33. data/spec/unit/bollettino/renderer/payer_spec.rb +41 -0
  34. data/spec/unit/bollettino/renderer/payment_order_spec.rb +40 -0
  35. data/spec/unit/bollettino/renderer/slip_spec.rb +54 -0
  36. metadata +81 -51
  37. data/lib/bollettino/models/address.rb +0 -18
  38. data/lib/bollettino/models/payee.rb +0 -17
  39. data/lib/bollettino/models/payer.rb +0 -16
  40. data/lib/bollettino/models/payment_order.rb +0 -20
  41. data/lib/bollettino/models/slip.rb +0 -21
  42. data/lib/bollettino/renderer.rb +0 -47
  43. data/lib/bollettino/renderers/address_renderer.rb +0 -24
  44. data/lib/bollettino/renderers/payee_renderer.rb +0 -26
  45. data/lib/bollettino/renderers/payer_renderer.rb +0 -20
  46. data/lib/bollettino/renderers/payment_order_renderer.rb +0 -37
  47. data/lib/bollettino/renderers/slip_renderer.rb +0 -21
  48. data/spec/unit/bollettino/models/address_spec.rb +0 -12
  49. data/spec/unit/bollettino/models/payee_spec.rb +0 -10
  50. data/spec/unit/bollettino/models/payer_spec.rb +0 -12
  51. data/spec/unit/bollettino/models/payment_order_spec.rb +0 -11
  52. data/spec/unit/bollettino/models/slip_spec.rb +0 -15
  53. data/spec/unit/bollettino/renderers/address_renderer_spec.rb +0 -23
  54. data/spec/unit/bollettino/renderers/payee_renderer_spec.rb +0 -37
  55. data/spec/unit/bollettino/renderers/payer_renderer_spec.rb +0 -27
  56. data/spec/unit/bollettino/renderers/payment_order_renderer_spec.rb +0 -39
  57. 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