[LRUG] Serialising a struct
Siddharth Sharma
svs at svs.io
Mon Apr 14 07:20:38 PDT 2014
Does this help?
https://ruby.awsblog.com/post/Tx2SU6TYJWQQLC3/Stubbing-AWS-Responses
On Mon, Apr 14, 2014 at 7:37 PM, Stephen Nelson-Smith <sanelson at gmail.com>wrote:
> I'm working with some code that makes use of the new AWS SDK (
> https://github.com/aws/aws-sdk-core-ruby) to retrieve data from (and make
> calls into) AWS.
>
> 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.
>
> What's the best way to make a struct available as canned data? I can view
> the data I want as a struct using pry... or I can dump the API response
> using VCR, but neither really helps. The API is actually just XML, and I
> can't work out how to serialise the struct so I can get it back again as a
> struct... Marshal doesn't support dumping from a Struct, JSON gives me a
> string representation, and YAML gives me a Psych::Nodes::Document object...
>
> Any ideas?
>
> S.
>
> --
> Stephen Nelson-Smith
> Technical Director
> Atalanta Systems Ltd
> www.atalanta-systems.com
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140414/2f35e68f/attachment-0003.html>
More information about the Chat
mailing list