ruby-on-railsunit-testingtwittermockingtweetstream

Mocking out TweetStream in Rails


I'm making an app where one of my key pieces of code is executed whenever I receive a status update from an instance of the TweetStream gem's user stream client, and I'm getting to the point where I really need Unit Tests to make sure the code acts properly.

Is there a way of making unit tests for a Twitter User Stream by mocking the methods out or something? Fake requests?

I'm on rails 3.2 ruby 1.9.2


Solution

  • You can use something like this:

    https://github.com/stympy/faker

    Hope it helps.