2024-03-27 09:16:00 -06:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
module ExchangeRateProviderInterfaceTest
|
|
|
|
extend ActiveSupport::Testing::Declarative
|
|
|
|
|
|
|
|
test "exchange rate provider interface" do
|
2024-08-16 12:13:48 -04:00
|
|
|
assert_respond_to @subject, :healthy?
|
2024-03-27 09:16:00 -06:00
|
|
|
assert_respond_to @subject, :fetch_exchange_rate
|
2024-08-16 12:13:48 -04:00
|
|
|
assert_respond_to @subject, :fetch_exchange_rates
|
2024-03-27 09:16:00 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
test "exchange rate provider response contract" do
|
2024-08-01 19:43:23 -04:00
|
|
|
VCR.use_cassette "synth/exchange_rate" do
|
|
|
|
response = @subject.fetch_exchange_rate from: "USD", to: "MXN", date: Date.iso8601("2024-08-01")
|
2024-03-27 09:16:00 -06:00
|
|
|
|
|
|
|
assert_respond_to response, :rate
|
|
|
|
assert_respond_to response, :success?
|
|
|
|
assert_respond_to response, :error
|
|
|
|
assert_respond_to response, :raw_response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|