Sha256: 82c32805c8d09373fd85216c3c90fadc87ad8151887368a31b3faa276f4beab9
Contents?: true
Size: 614 Bytes
Versions: 12
Compression:
Stored size: 614 Bytes
Contents
FactoryBot.define do factory :author do name { Faker::Name.name } end factory :comment do transient { author { nil } } before(:create) do |record, evaluator| if evaluator.author author = Author.find_or_create_by(name: evaluator.author) record.author_id = author.id end end end factory :post do status { :published } transient { author { nil } } before(:create) do |record, evaluator| if evaluator.author author = Author.find_or_create_by(name: evaluator.author) record.author_id = author.id end end end end
Version data entries
12 entries across 12 versions & 1 rubygems