danconia 0.2.3 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ebf1db97ca89c6a822b12279f873193c97d7e9f412aa0054967cf02e1d3f74d
4
- data.tar.gz: da1e807e1d5e0c4ec0619f8d93a7a023c4e8361c4b48a3f16b138c4013122fed
3
+ metadata.gz: 2ad8e13934be05481be0f5f5830df44fb673655b72478fb72521949c231d165c
4
+ data.tar.gz: bbf515b791d138967fa50435214ecdfe3f29e967f6b758f1731c82c2eb965aaa
5
5
  SHA512:
6
- metadata.gz: 1836de03b18616b074b76028d6ff6cf392e8148e294d80783a918836c9d75eb78aa2f6df666302a5d68435362f90091f3690daa7ca1c08bf1fa746bd4b0171ab
7
- data.tar.gz: bc00add76fb57dd0b30ddc8c0a2c4ba5790335bc4f4ad5dd4e29c73b2445fe5b3cec06edd8df2dd5eec4b9abcadc158196f2cb8a146807dcb43a6952b67f5c68
6
+ metadata.gz: 1cf5f8694e43c05f90aa6be8dbc07ebf9a8b07ae43ed1bf219ff0ab4e7a79cffd0c69220997b7733eb8b78900e987fe61a2c18acc1fb361daef3a4f96cfce610
7
+ data.tar.gz: 5168ff74019cec1a6b39536fe6ffc1f7b94d9adb9dd7610692305990768db8c3b6fcd8c07dec8b276c2f57eb1bea5d6a9e5f7e5730a46ca74c020fac27474faf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danconia (0.2.3)
4
+ danconia (0.2.4)
5
5
  activerecord (>= 3.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -65,6 +65,18 @@ Product.new(price: 30, price_currency: 'ARS').price # => 30 ARS
65
65
 
66
66
  Currently, there is no option to customize the names of the columns but should be fairly simple to implement if needed.
67
67
 
68
+ ## Testing
69
+
70
+ There is a FixedRates exchange that can be used during testing to supply static rates (see `examples/fixed_rates.rb`). Another possibility is to use the following helper:
71
+
72
+ ```ruby
73
+ require 'danconia/test_helpers'
74
+
75
+ Danconia::TestHelpers.with_rates 'USDARS' => 3 do
76
+ Money(2, 'USD').exchange_to('ARS') # => 6.0 ARS
77
+ end
78
+ ```
79
+
68
80
  ## Contributing
69
81
 
70
82
  1. Fork it
@@ -75,6 +75,10 @@ module Danconia
75
75
  (self * 100).round
76
76
  end
77
77
 
78
+ def as_json *args
79
+ amount.as_json *args
80
+ end
81
+
78
82
  def default_currency?
79
83
  currency.code == Danconia.config.default_currency
80
84
  end
@@ -1,3 +1,3 @@
1
1
  module Danconia
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -167,6 +167,12 @@ module Danconia
167
167
  end
168
168
  end
169
169
 
170
+ context 'to_json' do
171
+ it 'should delegate to the amount' do
172
+ expect(Money(1).to_json).to eq '"1.0"'
173
+ end
174
+ end
175
+
170
176
  def fake_exchange args = {}
171
177
  double 'exchange', args.reverse_merge(rate: nil)
172
178
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danconia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Nicolau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-06 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord