jeudi 26 novembre 2015

Spec fails due to FactoryGirl-created Devise user failure

  • Rails 3.2.22 (yeah yeah)
  • RSpec 2.99.2 (ditto)
  • FactoryGirl 4.5
  • Devise 3.5.2

Spec fails with:

Failure/Error: let(:user) { create :user }
NoMethodError:
  undefined method `encrypted_password=' for #<User:0x007fc5d15c0550>

And indeed, if I pry at that point, I see this:

[1] pry> User
=> User(id: integer, email: string, crypted_password: string, password_salt: string, etc...

In rails c I see what I expect:

[1] pry> User.new.respond_to?(:encrypted_password=)
=> true
[3] pry(main)> User.new.respond_to?(:crypted_password)
=> false

What's happening here? Why can't I create a user in my factory, and where are my expected methods?

Aucun commentaire:

Enregistrer un commentaire