title: Rspec redirect to testing
body: <p>In my controller when an user creates a new post, he/she is redirected to the page that contains the newly created post. I'm wanting to create a test in rspec to cover this redirect but am having trouble with it. Specifically, I want to know what to write in the refirst_to argument. Here is the controller code below..</p>
  
  <pre><code>def create
  @micropost = Micropost.new(params[:micropost])
   respond_to do |format|
    if @micropost.save
      format.html {redirect_to @micropost}
    else
      format.html {render action: 'edit'} 
    end
  end
  end
  </code></pre>
  
  <p>Here is the rspec test...</p>
  
  <pre><code>before do
    @params = FactoryGirl.build(:micropost)
  end
  
  it "redirects to index" do
    #clearly @params.id doesn't work. its telling me instead of a redirect im getting a 
    #200
    #response.should redirect_to(@params.id)
  end
  </code></pre>