respond_to order is important
May 3rd, 2006
This is the test I wrote. You’ll notice it is almost verbatim the scaffolded test.
Interestingly, I made it fail with the following simple code:
The failure was: Flipping the order of myrespond_to block did the trick:
This is partially logical. Of course, the request doesn’t have an Accept header, so Rails uses the default, which is to return in order the order of definition.
Alternatively, setting the request’s Accept header would do the trick:
Leave a Reply