I am doing functional tests for my controllers with Rspec. I have set my default response format in my router to JSON, so every request without a suffix will return JSON.
The following works for me with rspec 3:
before :each do request.headers["accept"] = 'application/json' end
This sets HTTP_ACCEPT.
HTTP_ACCEPT