robfletcher/betamax — pull request #70 by steveims (2012-10-18 02:00:40+00:00)
Title: Support sequential read/write tape modes

Rob, thanks for betamax! We've been using it to enable component testing. Along the way, we've found that one of our preferred usage patterns relies upon a sequence of HTTP interactions. For example, one of our common scenarios is business logic that manipulates a data object. Part of that logic includes simple interactions to a backend system, such as:
1. GET /resource
2. modify the entity, then PUT /resource
3. GET /resource

betamax doesn't distinguish interactions 1 and 3, so we added sequential read/write tape modes:
WRITE_SEQUENTIAL records each HTTP interaction in order.
READ_SEQUENTIAL replays the HTTP interactions in order; if the HTTP request doesn't match the next recorded request, then we throw an IllegalStateException. Thus READ_SEQUENTIAL asserts that each request matches the recorded request.

This pull request contains themodifications to support sequential read/write tape modes. I offer this for your consideration as a new feature for betamax.

Thanks again for this project!

-- Steve