title: Integration testing with Authlogic?
body: <p>For the life of me I don't understand why Authlogic isn't logging me in in this integration test.  I haven't had any problems w/ Authlogic logging me in in functional tests using this code. According to the authlogic rdocs (<a href="http://tinyurl.com/mb2fp2" rel="noreferrer">http://tinyurl.com/mb2fp2</a>), simulating a logged-in state is the same in functional &amp; integration tests, so i'm pretty confused.  any help is MUCH appreciated!</p>
  
  <pre><code>class TipsController &lt; ApplicationController
    before_filter :require_user,  :only =&gt; [:destroy, :undelete]
    def destroy
      @tip = Tip.find(params[:id])
  
      if can_delete?(@tip)
  
        @tip.destroy
  
        set_flash("good", "Tip deleted. &lt;a href=\"#{undelete_tip_url(@tip.id)}\"&gt;Undo?&lt;/a&gt;")
        respond_to do |format|
          format.html { redirect_to city_path(@tip.city)} 
        end
      else
        set_flash("bad", "Seems like you can't delete this tip, sorry.")
        respond_to do |format|
          format.html { render :action =&gt; "show", :id =&gt; @tip} 
        end
      end
    end
  end
  
  
  class DeleteTipAndRender &lt; ActionController::IntegrationTest
    context "log user in" do
      setup do
        @user = create_user
        @tip = create_tip
      end
  
      context "delete tip" do
        setup do
          activate_authlogic
          UserSession.create(@user)
          @us = UserSession.find
          post "/tips/destroy", :id =&gt; @tip.id
        end
  
        should_redirect_to("city_path(@tip.city)"){city_path(@tip.city)} 
      end
    end
  end
  </code></pre>