title: How do I get at the params included in an RSpec response to examine it?
body: <p>I am writing a controller spec (RSpec with Devise), and I know that the response returns the parameter I passed in to it (correctly so), because I see it in the output as this:</p>
  
  <p><code>...@params={"email" =&gt; "maddison_stokes@schumm.org", ...</code></p>
  
  <p>This is my controller spec:</p>
  
  <pre><code>  describe 'POST #create' do
      context 'when invited user IS an existing user' do
          before :each do
            @users =  [
              attributes_for(:user),
              attributes_for(:user),
              attributes_for(:user)
            ]
          end
  
          it 'correctly finds User record of invited user' do
            login_user
            post :create, { email: @users.first[:email] }
            expect(response.params[:email]).to include(@users.first[:email])
          end
       end
    end
  </code></pre>
  
  <p>When I run the test above, I get this error:</p>
  
  <pre><code>  1) Users::InvitationsController POST #create when invited user IS an existing user correctly finds User record of invited user
       Failure/Error: expect(response.params[:email]).to include(@users.first[:email])
       NoMethodError:
         undefined method `params' for #&lt;ActionController::TestResponse:0x007fa50d1ee6a0&gt;
  </code></pre>
  
  <p>This is what the entire output of the response looks like:</p>
  
  <p><a href="https://gist.github.com/marcamillion/c2e3f4d0bdae05c2be1f" rel="nofollow">https://gist.github.com/marcamillion/c2e3f4d0bdae05c2be1f</a></p>
  
  <p>I tried to paste it here, but SO screamed at me for exceeding the 30,000 character limit. I would have truncated it, but didn't want to remove any info that may be necessary.</p>
  
  <p>What I am trying to do is basically verify that the email in <code>params[:email]</code> contained in the <code>response</code> is the same email I passed to it. I know it is intuitively but I would like to do it programmatically. </p>