Je cette usineComment utiliser Factory girl pour créer une entreprise?
FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
password { 'TarXlrOPfaokNOzls2U8' }
end
end
Ce qui fonctionnait très bien jusqu'à ce que j'ai ajouté la validation de l'association
class User < ActiveRecord::Base
has_many :companies, :through => :positions
has_many :positions
validates_presence_of :company
Comment puis-je ajouter à mon usine pour atteindre cet
J'ai essayé
association :company, factory: :company, strategy: :build
Mais tous mes tests échouent avec
undefined method `company=' for #<User:0x007fcd7c13c260>
toute aide serait appréciée
awesome thanks .. – Trace