... I am curious to know that will this test be too fragile? if the balance changes somehow?
Short answer: yes, with an "if." Long answer: no, with a "but."
The tests are wrapped in a vcr_cassette
closure that records the first request to a .yml
file. Subsequent test runs will not be affected by real-world changes on the side-chain until the .yml
file is deleted. I have a task called rake clean:vcr
that deletes all of these .yml
files, which I use for picking up real-world changes. In that situation, yes, this test would break.
This approach means Continuous Integrations won't break, which is all I want. Typically, I only delete the .yml
files as a last step. I actually recommend some fragile tests like this to help test around null hypothesis assumptions.
Good point about the Stream
class. Thanks for the suggestions.