Mock a Savon Response object

I am building a gem that wraps a SOAP API and needed to test code that handled the response object. To do this I first needed a response object, and I didn't want to have to make a real soap call.

I used a Struct to mock up the Http object that Savon::Response is expecting, using xml copied from a real response as the body. I then instantiated the Global and Local options objects, and passed them and the mock-Http object into Savon::Response.