Sha256: efb339ab60f068b6786e64693cbf0827855787f7832809960d1b72685f69d380
Contents?: true
Size: 579 Bytes
Versions: 2
Compression:
Stored size: 579 Bytes
Contents
# frozen_string_literal: true FactoryGirl.define do factory :group do title 'Test Title' transient do owner { User.order('RANDOM()').first } 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paid_up-0.12.4 | spec/factories/group.rb |
paid_up-0.12.3 | spec/factories/group.rb |