# Testing XML over HTTP in a Rails app

**URL:** <https://www.ruby-forum.com/t/testing-xml-over-http-in-a-rails-app/130687>\
**Category:** Rails\
**Created:** [March 1, 2008, 10:40pm UTC](https://www.ruby-forum.com/t/testing-xml-over-http-in-a-rails-app/130687 "2008-03-01T22:40:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olly\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/eb8c5e/32.png) [@Olly\_L](https://www.ruby-forum.com/u/Olly_L)\
**Post date:** [March 1, 2008, 10:40pm UTC](https://www.ruby-forum.com/t/testing-xml-over-http-in-a-rails-app/130687/1 "2008-03-01T22:40:32Z")

</div>

Hi

I’m looking at testing the XML API methods of my RESTful controllers  
– create, update etc. I thought this would be really  
straightforward, and perhaps it is, but I’m struggling to find a good  
explanation of how to go about it the Rails way.

Firstly, I can successfully test it from the command line using curl,  
e.g:

curl -H “Accept: application/xml” -X GET --basic -u user:password  
[http://myapp:3000/clients](http://myapp:3000/clients)

However I’d really like automated functional tests for all these  
methods, just as I have for the HTML responses in my controllers.

I’ve read a little about ActiveResource::HttpMock which looks like it  
could be useful, but ideally I’d like to test the actual XML requests  
to my controllers.

Can anyone shed any light on the correct way to do this and any  
reading resources?

Thanks a lot,  
Olly
