HttpMock Post Parameters

Does anyone know how you can specify the body of an HttpMock post as
well as the body of the response?

I’m trying to test a restful API where the parameters are posted in in
the body of the post as XML and the response is XML in the response

As far as I can tell, you can only specify one body in a mock object?


I never got a reply, so either I’m crazy or other people have just
lived with the issue. In any event, I wanted to post my work around.
Rather than creating my mock request/response pairs using the
ActiveResource::HttpMock.respond_to method, I actually had to create
both the request and the response individually and then add them to
the ActiveResource::HttpMock.responses. Here is what I did:

Created my mock request:

request =,
path = “/my/path.xml”,
body =
request_headers =

Created my mock response:

response = =
status = 200,

Add the pair to the mock responses:

ActiveResource::HttpMock.responses << [request, response]