title: How do I test whether my controller rendered the right layout on Rails 3?
body: <p>Controller code:</p>
  
  <pre><code>class BooksController &lt; ApplicationController
    def index
      @books = Book.all
      respond_to do |format|
        format.html do
          render 'index', :layout =&gt; 'topgun'
        end
      end
    end
  end
  </code></pre>
  
  <p>How should I test this in the spec?</p>
  
  <pre><code>require 'spec_helper'
  
  describe BooksController do
    describe "GET index" do
      it "renders the topgun layout" do
        get :index
        # ???
      end
    end
  end
  </code></pre>
  
  <p>I checked <a href="https://stackoverflow.com/questions/109284/testing-rendering-of-a-given-layout-with-rspec-rails">this related post</a>, but my <code>response</code> object doesn't appear to have a <code>layout</code> attribute/method.</p>