title: RSpec Newbie: Devise/Cancan causing otherwise working controller spec to fail
body: <p>I'm trying to get an RSpec controller spec to pass. It's almost identical to the scaffold-generated spec, except a user is signed into devise first. <em>If</em> I disable 'load_and_authorize_resource' from the controller (which checks permissions), everything works fine. But if I put the line back in, it fails with:</p>
  
  <pre><code>  1) PostsController logged in administrator POST create with valid params assigns a newly created post as @post
       Failure/Error: post :create, :post =&gt; {'title' =&gt; 'test title'}
         &lt;Post(id: integer, title: string, cached_slug: string, content: text, user_id: integer, created_at: datetime, updated_at: datetime) (class)&gt; received :new with unexpected arguments
           expected: ({"title"=&gt;"test title"})
                got: (no args)
       # ./spec/controllers/posts_controller_spec.rb:52:in `block (5 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>I had assumed the spec wasn't logging in the user correctly, but a puts current_user.role.name confirms the user is logged in correctly, and has the necessary role. Performing the actual process in a browser confirms it works as desired.</p>
  
  <p>Anyone have any suggestions? I'm quite stumped. Controller below:</p>
  
  <pre><code>  def create
      @post = Post.new(params[:post])
      @post.user = current_user
      respond_to do |format|
        if @post.save
          flash[:notice] = "Post successfully created"
          format.html { redirect_to(@post)}
          format.xml  { render :xml =&gt; @post, :status =&gt; :created, :location =&gt; @post }
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @post.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>...And the spec</p>
  
  <pre><code>  describe "with valid params" do
      it "assigns a newly created post as @post" do
        Post.stub(:new).with({'title' =&gt; 'test title'}) { mock_post(:save =&gt; true) }
        post :create, :post =&gt; {'title' =&gt; 'test title'}
        assigns(:post).should be(mock_post)
      end
  </code></pre>
  
  <p>...And supporting stuff in the spec:</p>
  
  <pre><code>before(:each) do
    @user = Factory(:admin)
    sign_in @user
  end
  
    def mock_post(stubs={})
      @mock_post ||= mock_model(Post, stubs).as_null_object
    end
  </code></pre>
  
  <p>Many thanks...</p>