mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Implement Synth as an exchange rate provider (#574)
* Implement Synth as an exchange rate provider * Add assertions to provider interface test * Assert the correct provider error is raised * Remove unnecessary parens
This commit is contained in:
parent
a1b25f1c5b
commit
7ae25dd6df
16 changed files with 310 additions and 34 deletions
27
test/interfaces/exchange_rate_provider_interface_test.rb
Normal file
27
test/interfaces/exchange_rate_provider_interface_test.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require "test_helper"
|
||||
|
||||
module ExchangeRateProviderInterfaceTest
|
||||
extend ActiveSupport::Testing::Declarative
|
||||
|
||||
test "exchange rate provider interface" do
|
||||
assert_respond_to @subject, :fetch_exchange_rate
|
||||
end
|
||||
|
||||
test "exchange rate provider response contract" do
|
||||
accounting_for_http_calls do
|
||||
response = @subject.fetch_exchange_rate from: "USD", to: "MXN", date: Date.current
|
||||
|
||||
assert_respond_to response, :rate
|
||||
assert_respond_to response, :success?
|
||||
assert_respond_to response, :error
|
||||
assert_respond_to response, :raw_response
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def accounting_for_http_calls
|
||||
VCR.use_cassette "synth_exchange_rate" do
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue