<p>Given a controller method like: </p>

<pre><code>def show
  @model = Model.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml =&gt; model }
  end
end
</code></pre>

<p>What's the best way to write an integration test that asserts that the return has the expected XML?</p>

Set the request objects accept header:
```
```
@request.accept = 'text/xml' # or 'application/xml' I forget which
```
```
Then you can assert the response body is equal to what you were expecting
```
```
assert_equal '<some>xml</some>', @response.body
```
```