title: Why i can not get current_user while writing test case with Rspec and Capybara
body: <p>I have to write integration test case for my one feature listing page and that feature index method has code like below</p>
  
  <pre><code>def index
    @food_categories = current_user.food_categories
  end
  </code></pre>
  
  <p>Now when i try to write a test case for this it throws an error </p>
  
  <pre><code>'undefined method features for nil class' because it can not get the current user
  </code></pre>
  
  <p>Now what i have do is below
  I have write the login process in the before each statement and then write the test case for the features listing page</p>
  
  <p>Can you please let me know that how i can get the <code>current_user</code> ?</p>
  
  <p>FYI, I have used devise gem and working on integration test case with Rspec</p>
  
  <p>Here is <a href="https://gist.github.com/2319172" rel="nofollow">my spec file</a>
  And here is my <a href="https://gist.github.com/2319177" rel="nofollow">food_categories_spec.rb</a></p>