What you are really talking about are two different types of testing that you would like to perform - unit tests and integration tests.
Unit tests will verify the validity of methods regardless of any external data. You should learn some mocking structure based on any language you use. You basically want to say that with tests, something is equivalent to "if these assumptions are qualified, then this test should give ..." The creation frame will determine your assumptions, saying that certain classes / objects are set in a special way and can be considered valid. These are tests that will not depend on the fact that Twitter is alive, or the library / library of the third part that responds.
Integration tests will conduct live tests with the data source, consuming the library / API to perform valid actions. Where it becomes difficult, because you use a third-party service, write to the service (i.e., when creating new tweets). If so, you can always create an account on Twitter that can only be used for write operations. Typically, if you tested a local database β for example, you could instead use transactions to test similar operations; rollback transactions instead of committing them.
Here are a few high-level non-linguistic definitions:
I am from the .NET stack, so I wonβt pretend to know much about Ruby. However, a quick Google search showed the following:
source share