[mocha-developer] Need some help in reducing my repetions in tests with Mocha

John D. Hume duelin.markers at gmail.com
Sun May 4 09:30:05 EDT 2008

On Sat, May 3, 2008 at 4:40 PM, Jonathan Stott <jonathan.stott at gmail.com>

> Well, that is mostly because I don't want to implement a full URL params
> parser for testing, really :)

[To be clear, you wouldn't write a parser, you'd write a "builder."]

I wouldn't characterize this as a design change just for testing: you're
separating two responsibilities: (1) knowing how to talk to todoist, and (2)
knowing how to use Net::HTTP.  If todoist ever changes their api, you'll go
make changes in TodoistRequestBuilder (or whatever you call that) and won't
have to touch the thing that uses Net::HTTP.  If instead you find an HTTP
client library with more bells and whistles (or just a prettier API), you'll
change your HTTP thing and won't touch the TodoistRequestBuilder.

Here's a good read on the Single Responsibility Principle:

More information about the mocha-developer mailing list