Sha256: a6df62f57568a008ae1588adb6ad563c2be7fe75df4def56d403fca30f04dde5
Contents?: true
Size: 657 Bytes
Versions: 24
Compression:
Stored size: 657 Bytes
Contents
FactoryGirl.define do factory :group do title { Faker::Lorem.sentence } description { Faker::Lorem.paragraphs([*1..5].sample).join("\n\n") } transient do owner { User.order('RANDOM()').first } # member_count 5 end # the after(:create) yields two values; the user instance itself and the # evaluator, which stores all values from the factory, including transient # attributes; `create_list`'s second argument is the number of records # to create and we make sure the user is associated properly to the post after(:create) do |group, evaluator| evaluator.owner.add_role(:owner, group) end end end
Version data entries
24 entries across 24 versions & 1 rubygems