Sha256: 514c7bce26401adb6d2080dfa5d7b3050c179d6ebc930e1bf238e562b95e34c6

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

class UserBuilder < Bob::Builder
  meta_build :user do |user|
    user.name = Faker::Name.first_name
    user.email = Faker::Internet.email
  end

  meta_build :customUser, User do |user, save, params|
    user.name = params[:name]
    user.email = params[:email]

    user.save! if save
  end    

  meta_build :forEachUser, User do |user|
    user.name = Faker::Name.first_name
    user.email = Faker::Internet.email
  end

  for_each :forEachUser do |user|
    user.avatar = Faker::Avatar.image
  end

  for_each :forEachUser, build: Comment, qty: 20 do |user, comment|
    comment.user = user
    comment.description = Faker::Lorem.paragraph
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bob-builder-0.1.1 test/dummy/lib/builders/user_builder.rb
bob-builder-0.1.0 test/dummy/lib/builders/user_builder.rb