Sha256: 1d8e54dd1d00d7680854780b383bd4c76d5605b8ffe45c04ab613848c70eaa0f

Contents?: true

Size: 548 Bytes

Versions: 21

Compression:

Stored size: 548 Bytes

Contents

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

21 entries across 21 versions & 1 rubygems

Version Path
paid_up-0.9.13 spec/factories/group.rb
paid_up-0.9.12 spec/factories/group.rb
paid_up-0.9.11 spec/factories/group.rb
paid_up-0.9.10 spec/factories/group.rb
paid_up-0.9.9 spec/factories/group.rb
paid_up-0.9.8 spec/factories/group.rb
paid_up-0.9.7 spec/factories/group.rb
paid_up-0.9.6 spec/factories/group.rb
paid_up-0.9.5 spec/factories/group.rb
paid_up-0.9.4 spec/factories/group.rb
paid_up-0.9.3 spec/factories/group.rb
paid_up-0.9.2 spec/factories/group.rb
paid_up-0.9.1 spec/factories/group.rb
paid_up-0.9.0 spec/factories/group.rb
paid_up-0.8.1 spec/factories/group.rb
paid_up-0.7.11 spec/factories/group.rb
paid_up-0.7.10 spec/factories/group.rb
paid_up-0.7.9 spec/factories/group.rb
paid_up-0.7.8 spec/factories/group.rb
paid_up-0.7.7 spec/factories/group.rb