title: Testing devise views with rspec
body: <p>I have generated Devise's views running <code>rails g devise:views</code> and would now like to test them.</p>
  
  <p>This is what I have come up with:</p>
  
  <pre><code>require 'spec_helper'
  
  describe "devise/sessions/new" do
      before do
          render
      end
  
      it "renders the form to log in" do
          rendered.should have_selector("form", action: user_session_path, method: :post) do |form|
  
          end
      end
  end
  </code></pre>
  
  <p>For the render statement it gives me <code>undefined local variable or method 'resource'</code>. After <a href="https://groups.google.com/forum/?fromgroups=#!topic/plataformatec-devise/fMuUbVUQa3U">googling around</a> I found that I should add</p>
  
  <pre><code>@user.should_receive(:resource).and_return(User.new)
  </code></pre>
  
  <p>before the render statement - but it still gives me the same error, and I am not really sure how to use it.</p>
  
  <p>What am I doing wrong? Thanks for your help.</p>