Testing (RSpec) with Devise's confirmable module

后端 未结 7 1108
不思量自难忘°
不思量自难忘° 2020-12-24 13:06

It\'s my understanding that Rails\' testing environment is torn down and rebuilt before each test...so how do I test a controller that requires that a user be logged in and

7条回答
  •  佛祖请我去吃肉
    2020-12-24 13:40

    for latest FactoryGirl version:

    FactoryGirl.define do
    
      factory :confirmed_user, :parent => :user do
        after(:create) { |user| user.confirm! }
      end
    
    end
    

提交回复
热议问题