If you're drinking the latest flavor of Rails kool-aid, you are no doubt hard at work rewriting all of your controllers to conform to RESTful principles.  Good for you!  In your rush to coolness, however, don't forget to do the janitorial work of testing those great new actions.  I recently added Accept-based processing to one of my controller actions, and I wanted to test the XML response separately.  I couldn't figure out how to send the Accept: header in a test GET request for the life of me, until I stumbled upon Francois Beausoleil's post about respond_to order.  The simple answer:

@request.env['HTTP_ACCEPT'] = 'application/xml'

Stick that into your test method right before your get / post, and you should be good to go.

Tags: , , ,