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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -0
- data/lib/danconia/money.rb +4 -0
- data/lib/danconia/version.rb +1 -1
- data/spec/danconia/money_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad8e13934be05481be0f5f5830df44fb673655b72478fb72521949c231d165c
|
4
|
+
data.tar.gz: bbf515b791d138967fa50435214ecdfe3f29e967f6b758f1731c82c2eb965aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf5f8694e43c05f90aa6be8dbc07ebf9a8b07ae43ed1bf219ff0ab4e7a79cffd0c69220997b7733eb8b78900e987fe61a2c18acc1fb361daef3a4f96cfce610
|
7
|
+
data.tar.gz: 5168ff74019cec1a6b39536fe6ffc1f7b94d9adb9dd7610692305990768db8c3b6fcd8c07dec8b276c2f57eb1bea5d6a9e5f7e5730a46ca74c020fac27474faf
|
data/Gemfile.lock
CHANGED
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
|
data/lib/danconia/money.rb
CHANGED
data/lib/danconia/version.rb
CHANGED
data/spec/danconia/money_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|