title: Devise Rspec tests not passing. Can't figure out why
body: <p>I've got an app in which I'm extending Devise's RegistrationsController to add some of my own functionality, and for some reason, I can't get of my account creation tests to pass. Everything works fine in development, so I'm almost positive it has something to do with the way I'm writing the test, but honestly, I'm willing to try anything at this point. So frustrating.</p>
  
  <p>Here's an excerpt from my test. You'll see it's checking for a new user, but it's not finding one.</p>
  
  <pre><code>describe RegistrationsController do
    before :each do
      @request.env['devise.mapping'] = Devise.mappings[:user]
      @new_user = { 'fname' =&gt; 'Stizzle',
                    'lname' =&gt; 'Mcgizzle',
                    'email' =&gt; 'qwerty@example.com',
                    'password' =&gt; 'foobar'
                  }
    end
    describe "During a regular registration, " do
      it "filling out the fields correctly should create a new user" do
        RegistrationsController.stub(:verify_recaptcha).and_return(true)
          expect do
            post  :create,
            :user =&gt; @new_user,
            :recaptcha_response_field =&gt; 'foobar',
            'tos-agree' =&gt; 'true'
            end.to change(User.all, :count).by(1)
          end
  </code></pre>
  
  <p>And my controller action:</p>
  
  <pre><code>def create
    build_resource
    if verify_recaptcha(:model =&gt; resource, :message =&gt; "The text you entered did not match.  Please try again.") &amp;&amp; resource.save
      if resource.active_for_authentication?
        set_flash_message :notice, :signed_up if is_navigational_format?
        sign_in(resource_name, resource)
        respond_with resource, :location =&gt; after_sign_up_path_for(resource)
      else
        set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
        expire_session_data_after_sign_in!
        respond_with resource, :location =&gt; after_inactive_sign_up_path_for(resource)
      end
    else
      clean_up_passwords resource
      render :action =&gt; 'new'
    end
  end
  </code></pre>
  
  <p>I tried removing the CAPTCHA from the controller just to see if that might be causing some trouble, but it had no effect.</p>
  
  <p>Thoughts?</p>