historical-bank 0.1.6 → 0.1.7
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/AUTHORS +1 -0
- data/CHANGELOG.md +3 -0
- data/historical-bank.gemspec +1 -1
- data/lib/money/bank/historical.rb +1 -1
- data/spec/bank/historical_spec.rb +32 -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: e568c08d9edc80b5179c9f5213e673cb6903970cff5c0a4fa39b129216828c2a
|
4
|
+
data.tar.gz: 50c5a20b8e49885b1e236ce396c2338b485fb9f8bf97bf3ca306866003b9923c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbaa94ddb35713b5d9493c1093227b130d76122d6888d8a48fb2c6157998bfb244bc4ed286d86d63e7b501263928d818f8e1b7db4a6b5f4d63074ec1a1c62f59
|
7
|
+
data.tar.gz: 261784912fbac3b807e24a480b3d7ca93c34aa286a8b5c839993cdeccd8e2f4fc835768807c0e2a8dab72208711dee81ca23c65d11b76fe2b401c84b58687406
|
data/AUTHORS
CHANGED
data/CHANGELOG.md
CHANGED
data/historical-bank.gemspec
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
Gem::Specification.new do |s|
|
18
18
|
s.name = 'historical-bank'
|
19
|
-
s.version = '0.1.
|
19
|
+
s.version = '0.1.7'
|
20
20
|
s.summary = 'Historical Bank'
|
21
21
|
s.description = 'A `Money::Bank::Base` with historical exchange rates'
|
22
22
|
s.authors = ['Kostis Dadamis', 'Emili Parreno']
|
@@ -357,6 +357,38 @@ class Money
|
|
357
357
|
|
358
358
|
it { is_expected.to eq expected_result }
|
359
359
|
end
|
360
|
+
|
361
|
+
context 'when rates do not exist anywhere' do
|
362
|
+
let(:from_currency_base_rates_store) { nil }
|
363
|
+
let(:to_currency_base_rates_store) { nil }
|
364
|
+
let(:rates_provider) { nil }
|
365
|
+
|
366
|
+
it 'raises an error' do
|
367
|
+
expect { subject }.to raise_error(NoMethodError)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context 'when rates exist in Redis but then disappear from Redis' do
|
372
|
+
let(:from_currency_base_rates_store) { from_currency_base_rates }
|
373
|
+
let(:to_currency_base_rates_store) { to_currency_base_rates }
|
374
|
+
let(:rates_provider) { nil }
|
375
|
+
|
376
|
+
it 'uses the value cached in memory' do
|
377
|
+
# first get it from Redis
|
378
|
+
expect_any_instance_of(RatesStore::HistoricalRedis).to receive(:get_rates)
|
379
|
+
.with(from_currency)
|
380
|
+
expect_any_instance_of(RatesStore::HistoricalRedis).to receive(:get_rates)
|
381
|
+
.with(to_currency)
|
382
|
+
expect(bank.exchange_with_historical(from_money, to_currency, datetime)).to eq expected_result
|
383
|
+
|
384
|
+
# then get it from memory
|
385
|
+
expect_any_instance_of(RatesStore::HistoricalRedis).not_to receive(:get_rates)
|
386
|
+
.with(from_currency)
|
387
|
+
expect_any_instance_of(RatesStore::HistoricalRedis).not_to receive(:get_rates)
|
388
|
+
.with(to_currency)
|
389
|
+
expect(bank.exchange_with_historical(from_money, to_currency, datetime)).to eq expected_result
|
390
|
+
end
|
391
|
+
end
|
360
392
|
end
|
361
393
|
|
362
394
|
# taken from real rates from XE.com
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: historical-bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kostis Dadamis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: money
|