title: Rspec 2 + Devise + Cancan - Factorygirl = Controller Testing not working
body: <p>I'm trying to move to rspec for testing, but I can't get controller testing to work with user authentication.  Testing a route that doesn't require a user works.</p>
  
  <pre><code>require 'spec_helper'
  
  describe UddsController do
    include Devise::TestHelpers
    render_views
  
    before (:each) do
      @user = User.new(:email =&gt; "test@user.com", :username =&gt; "test123")
      @user.roles &lt;&lt; Role.find_or_create_by_name("admin")
      @user.save
      sign_in @user
    end
  
    it "should get index" do
      get :index
      response.should be_success
    end
  </code></pre>
  
  <p>I just get</p>
  
  <pre><code>  2) UddsController should get index
       Failure/Error: response.should be_success
         expected success? to return true, got false
       # ./spec/controllers/udds_controller_spec.rb:21
  </code></pre>
  
  <p>I'm not using factory_girl.  All the example fixes here and on google seem to.  I don't see why what I've done wouldn't work.  Error is useless in debugging.</p>
  
  <p>I know this question has been asked to death.  I've read every blog and forum I can find.  I'm at a dead end.</p>