Ruby on Rails functional test with Devise authentication

前端 未结 3 1821
深忆病人
深忆病人 2021-02-06 02:57

I\'m searching for a solution for a weird problem. I have a controller, that needs authentication (with the devise gem). I added the Devise TestHelpers but i can\'t get it worki

3条回答
  •  我寻月下人不归
    2021-02-06 03:07

    I had a similar issue (but using FactoryGirl, rather than Fixtures) and was able to resolve it by simply using FactoryGirl.create(:user) rather than FactoryGirl.build(:user).

    Evidently, Devise requires the user to have been persisted to the Database, for everything to work properly.

提交回复
热议问题