Separate the fetching and loading of rates #15
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does a little bit of refactoring so that I could more cleanly fetch remote rates and then load and get them. I renamed the
OpenExchangeRatesLoader
toOpenExchangeRatesFetcher
to sync up with this change. I also removed it from theMoney
namespace because it's sorta unrelated - it's just a class that can compute URLs and make http requests.Another side effect of this work was a cleaner surface to add unit tests for this fetcher! I added a file for it and then wrote up the three tests that seemed most obvious to me. Then I went to the existing test file and made that one more of an integration test.
I found that the fixture data checked into the repo was from 2011-10-18 by doing this:
So then I just moved the file into a fixtures folder and renamed it to be more clear about what it is and it's purpose.
Note: this diff is big because I did the work on top of #14. Once that PR is merged, then I'll come back to this one and rebase and then it'll be much more sensible! Then I'll take off the WIP from the title and it can be merged.