Update, 2011-06-16, 12:15 AM Thanks for the comments.

(I swear I had something like that before and it didn’t work!) Here’s the solution:

— Original blog entry —

I wrote a couple tests for a small CouchDB access wrapper today. But when I wrote the implementation itself, I realized that my class setup depends on an actual CouchDB server being available and here my journey began.

Example code

Consider the following example:

My objective is not to be able to test any of the protected methods directly, but to be able to supply a fixture so we don’t have to setup CouchDB to run our testsuite. My fixture would replace makeRequest() and return a JSON string instead.