|
1 | 1 | defmodule Forex.FeedReqTest do |
2 | 2 | use ExUnit.Case, async: true |
3 | 3 |
|
| 4 | + alias Forex.Feed.Req |
| 5 | + |
4 | 6 | @moduletag :integration |
5 | 7 |
|
6 | 8 | @bad_feed_url "https://these-are-not-the-droids-you-are-looking-for.io" |
7 | 9 |
|
8 | 10 | describe "get_latest_rates/1" do |
9 | 11 | test "fetches the latest exchange rates from the European Central Bank (ECB)" do |
10 | | - assert {:ok, body} = Forex.Feed.Req.get_latest_rates() |
| 12 | + assert {:ok, body} = Req.get_latest_rates() |
11 | 13 | assert String.starts_with?(body, "<?xml version=") |
12 | 14 | assert String.contains?(body, "<Cube currency='USD'") |
13 | 15 |
|
14 | | - assert {:error, _} = Forex.Feed.Req.get_latest_rates(url: @bad_feed_url) |
| 16 | + assert {:error, _} = Req.get_latest_rates(url: @bad_feed_url) |
15 | 17 | end |
16 | 18 | end |
17 | 19 |
|
18 | 20 | describe "get_last_ninety_days_rates/1" do |
19 | 21 | test "fetches the exchange rates from the last ninety days from the ECB" do |
20 | | - assert {:ok, body} = Forex.Feed.Req.get_last_ninety_days_rates() |
| 22 | + assert {:ok, body} = Req.get_last_ninety_days_rates() |
21 | 23 | assert String.starts_with?(body, "<?xml version=") |
22 | 24 | assert String.contains?(body, "<Cube currency=\"GBP\"") |
23 | 25 |
|
24 | | - assert {:error, _} = Forex.Feed.Req.get_last_ninety_days_rates(url: @bad_feed_url) |
| 26 | + assert {:error, _} = Req.get_last_ninety_days_rates(url: @bad_feed_url) |
25 | 27 | end |
26 | 28 | end |
27 | 29 |
|
28 | 30 | describe "get_historic_rates/1" do |
29 | 31 | test "fetches the historic exchange rates feed from the ECB" do |
30 | | - assert {:ok, body} = Forex.Feed.Req.get_historic_rates() |
| 32 | + assert {:ok, body} = Req.get_historic_rates() |
31 | 33 | assert String.starts_with?(body, "<?xml version=") |
32 | 34 | assert String.contains?(body, "<Cube currency=\"JPY\"") |
33 | 35 |
|
34 | | - assert {:error, _} = Forex.Feed.Req.get_historic_rates(url: @bad_feed_url) |
| 36 | + assert {:error, _} = Req.get_historic_rates(url: @bad_feed_url) |
35 | 37 | end |
36 | 38 | end |
37 | 39 | end |
0 commit comments