0
我有2类用户和认证,然后认证的has_many用户:HAS_MANY协会FactoryGirl
用户等级:
FactoryGirl.define do
factory :user do
first_name "Juan"
last_name "Iturralde"
sequence(:email) { |n| "person-#{n}@example.org" }
password "1234567890"
password_confirmation "1234567890"
is_admin false
factory :admin do
is_admin true
end
after(:create) do |user|
create(:authentication, user: user)
end
end
end
认证类:
FactoryGirl.define do
factory :authentication do
user {User.first || create(:user)}
provider "Apple"
uid "uid"
end
end
,我现在不。如何创建用户身份验证?
请看看到[协会(https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#associations )入门指南部分 – wik 2017-02-17 13:30:09