Sha256: c5721c5bda462db042a3efd5d2cf1cd4348402d5f73d51f4930bce45b56cd6dc

Contents?: true

Size: 374 Bytes

Versions: 4

Compression:

Stored size: 374 Bytes

Contents

FactoryBot.define do
  factory :article do
    title { Faker::Quote.famous_last_words }
    body { Faker::Lorem.paragraphs(number: rand(4...10)).join("\n") }
    is_featured { [true, false].sample }
    published { rand(1..10) > 8 ? nil : rand(1..20).days.ago }
    # employee { nil }
    # tenant { nil }
    trait :unpublished do
      published { nil }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/factory_bot/custom_factories/article.rb
rails_app_generator-0.3.5 after_templates/addons/factory_bot/custom_factories/article.rb
rails_app_generator-0.3.4 after_templates/addons/factory_bot/custom_factories/article.rb
rails_app_generator-0.3.3 after_templates/addons/factory_bot/custom_factories/article.rb