title: RSpec Rails NoMethodError: undefined method `password=' for User
body: <p>I have run the tests and it doesn't seem that the user get created by a Factory Girl. Here's what I got: </p>
  
  <p>reports_controller_spec.rb</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe ReportsController do
    let(:user) { create :user }
  
    before { sign_in user }
  
    describe 'GET #subjects' do
      subject { get :subjects }
  
      it_behaves_like 'template rendering action', :subjects
    end
  end
  </code></pre>
  
  <p>factories/users.rb</p>
  
  <pre><code>FactoryGirl.define do
    factory :user do
      email { Faker::Internet.safe_email }
      password { Faker::Internet.password }
    end
  end
  </code></pre>
  
  <p>And when I run the test I get this error: </p>
  
  <pre><code>ReportsController
    GET #subjects
      behaves like template rendering action
        example at ./spec/support/shared/template_rendering_action.rb:2 (FAILED - 1)
  
  Failures:
  
    1) ReportsController GET #subjects behaves like template rendering action 
       Failure/Error: Unable to find matching line from backtrace
       NoMethodError:
         undefined method `password=' for #&lt;User:0x000000063abd20&gt;
       Shared Example Group: "template rendering action" called from ./spec/controllers/reports_controller_spec.rb:11
  ...
  </code></pre>
  
  <p>I do not understand why it doesn't work. Anyone could point me to the mistake? Thanks.</p>
  
  <p>Edit: I'm using devise.</p>