title: Rspec: setting cookies in a helper test
body: <p>Helper Method</p>
  
  <pre><code>  # Determine if this is user's first time
    def first_time?
      cookies[:first_time].nil?
    end
  </code></pre>
  
  <p>Attempted Rspec test</p>
  
  <pre><code>it "returns true if the cookie is set" do
    cookies[:first_time] = "something"
    helper.first_time?().should be(true)
  end
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>undefined method `cookies' for nil:NilClass
  </code></pre>
  
  <p>Everything I've read about Rspec and cookies has to do with the controller. Any way to get/set cookies in Rspec helper tests?</p>
  
  <p>(Rspec/Rspec-rails 2.5, Rails 3.0.4)</p>
  
  <p>Thanks!!</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Found an answer on how to SET cookies, so I'll leave it here for other's reference.</p>
  
  <p>the piece I was looking for:</p>
  
  <pre><code>helper.request.cookies[:awesome] = "something"
  </code></pre>
  
  <p>Still don't know how to GET cookies...</p>