From 555e30519349698f20f3d5d25ab8a12d4b061d4a Mon Sep 17 00:00:00 2001 From: Piotr Date: Thu, 25 Oct 2018 16:19:46 +0200 Subject: [PATCH] Update money gem, use recommended 'Money.locale_backend' option --- lib/payday.rb | 1 + lib/payday/locale/en.yml | 4 ++++ lib/payday/money.rb | 1 + payday.gemspec | 2 +- spec/invoice_spec.rb | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/payday/money.rb diff --git a/lib/payday.rb b/lib/payday.rb index 8631105..ef0d17f 100644 --- a/lib/payday.rb +++ b/lib/payday.rb @@ -9,6 +9,7 @@ require_relative "payday/version" require_relative "payday/config" require_relative "payday/i18n" +require_relative "payday/money" require_relative "payday/line_itemable" require_relative "payday/line_item" require_relative "payday/pdf_renderer" diff --git a/lib/payday/locale/en.yml b/lib/payday/locale/en.yml index 008e9de..04add01 100644 --- a/lib/payday/locale/en.yml +++ b/lib/payday/locale/en.yml @@ -1,4 +1,8 @@ en: + number: + format: + delimiter: "," + separator: "." payday: status: paid: PAID diff --git a/lib/payday/money.rb b/lib/payday/money.rb new file mode 100644 index 0000000..452a5f5 --- /dev/null +++ b/lib/payday/money.rb @@ -0,0 +1 @@ +Money.locale_backend = :i18n diff --git a/payday.gemspec b/payday.gemspec index a0d0b4a..4423291 100644 --- a/payday.gemspec +++ b/payday.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| EOF s.add_dependency("prawn", "~> 1.0.0") - s.add_dependency("money", "~> 6.5") + s.add_dependency("money", "~> 6.13") s.add_dependency("prawn-svg", "~> 0.15.0.0") s.add_dependency("i18n", "~> 0.7") diff --git a/spec/invoice_spec.rb b/spec/invoice_spec.rb index 67c4363..e748ce9 100644 --- a/spec/invoice_spec.rb +++ b/spec/invoice_spec.rb @@ -172,6 +172,8 @@ module Payday LineItem.new(price: 5, quantity: 200, description: "Hats") ] * 30 + # If you want to check how it looks, use + # invoice.render_pdf_to_file("tmp/testing.pdf") expect(invoice.render_pdf).to match_binary_asset "testing.pdf" end end