[LRUG] Serialising a struct

Tom Stuart tom at codon.com
Mon Apr 14 08:48:39 PDT 2014

On 14 Apr 2014, at 15:07, Stephen Nelson-Smith <sanelson at gmail.com> wrote:
> My responsibility (ie the stuff I want to test) is once I've got the data, which I get from the aws-sdk-core library in the form of structs.  Obviously I don't want to keep calling AWS when testing, so I'm using a test double.

The suggestion may be too late to be practical, but this sounds like a potential opportunity to decouple the part of your application that queries AWS from the part that uses the resulting data, "hexagonal" style.

You could write an adapter that talks to the AWS gem on one side and passes data to your application on the other side, in whatever form is most convenient for your application (e.g. hashes, serialisable value objects that you define, or whatever). This'll make your actual business logic easier to test, and has the bonus of making it easier to swap out or upgrade the AWS gem in future.


More information about the Chat mailing list