fox-squirrels-2013/brickbat — pull request #17 by nicolejpaz (2013-11-22 22:21:00+00:00)
Title: Tests without twitter helper

Here's the thing with testing the Twitter API. There are two ways to test it: 1) either bypass the Twitter authentication entirely by writing a new module that replaces the helper during testing, or 2) use a gem that mimics the actual request.

Here are the issues with both:

1) Even if the authentication was bypassed, there are still problems with the fact that the create a tweet method will still try to make a tweet with the fake credentials.

2) Gems like VCR will record the actual request to the server, which is fine except for the fact that, during the real request, it includes the credentials for the valid user. So, it basically means that, during testing, that one user will create test tweets over and over.

None of these can be bypassed by creating a fake user. I tried that, and it gives an error if a test is run more than once. FactoryGirl may be able to get around that, but that means that more work is put into running a test that is faulty and messy.

So, unless someone else wants to work on the issue, I'm pushing these up for viewing. I'm going to focus my attention on testing the code committed today.