Sha256: 6f6f8f691248e423bc379655f4277c5906bcb03a0ebc80808160e9896f57f49e

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 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|
      group.save_with_owner(evaluator.owner)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paid_up-0.13.1 spec/factories/group.rb
paid_up-0.13.0 spec/factories/group.rb