Testing XML over HTTP in a Rails app

37 views
Skip to first unread message

Olly Lylo

unread,
Mar 1, 2008, 4:40:02 PM3/1/08
to Ruby on Rails: Talk
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

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
Reply all
Reply to author
Forward
0 new messages