title: Stub global cookies variable in Rspec Rails test
body: <p>The Rspec test looks like this:</p>
  
  <pre><code>RSpec.describe Api::UsersController, type: :controller do
      describe 'POST #create' do
          subject { post :create, params: create_params }
  
          context '...' do
  </code></pre>
  
  <p>In the controller, I use:</p>
  
  <pre><code>cookies.permanent[:foo] == 'bar'
  </code></pre>
  
  <p>However, I'm getting:</p>
  
  <pre><code>NameError:
         undefined local variable or method `cookies' for #&lt;Api::UsersController:0x000000137702f0&gt;
  </code></pre>
  
  <p>Another SO question has an answer that says to add <code>type: :request</code> to <code>describe</code>, but this causes other errors. I'd rather just completely stub out <code>cookies</code> so <code>cookies.permanent[:foo] == 'bar'</code> is always false. How do I do that?</p>