It is very, very difficult to test external dependencies in an automated repeatable fashion. At least without creating more framework to fake the external dependency than you've got code under test. And oftentimes that sort of thing is very fragile anyhow, leading to lots of false test failures.
I'm not a rubyist by any stretch of the measure, the following advise is going to be pretty language agnostic. What I would do here is to:
- Wrap the external dependency in my own interface. All my code should talk to this interface. and not patch directly to the library. Depending on the complexity of what the return data was, I would consider building my own DTO objects as well.
- Test my code against mocked or stubbed versions of this interface to ensure my end of the world is behaving correctly given correct inputs.
- Finally, try and find a way to test my pass-through interface to the external service. But at the end of the day this class tends to be so simple as to be not worth the effort.
But trying to unit test external services in a conventional sense can be maddening and horribly noneffective.
PS: I should add I just wrote an IRC bot over the last weekend. I did largely use TDD in C#, and I most certainly did not test the IRC connection angle outside of using nUnit as a harness to stand up the experimental code I needed to understand how the library works.