Sha256: 5881f241ab2ca34441ee682104ddb7054f800166442bb9a0869930061a0e4352

Contents?: true

Size: 577 Bytes

Versions: 4

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

FactoryBot.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|
      group.save_with_owner(evaluator.owner)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paid_up-0.13.5 spec/factories/group.rb
paid_up-0.13.4 spec/factories/group.rb
paid_up-0.13.3 spec/factories/group.rb
paid_up-0.13.2 spec/factories/group.rb