When calling Faker::Markdown, avoid "sandwich" method (#14685)

* When calling Faker::Markdown, avoid "sandwich" method

Since random can also be selected by random (without the exclude
list), avoid calling sandwich occassionally from random's call to
random.

This avoids generating body_markdown exceeding 12 newlines (which is
validated in Listing and prevents save, breaking the seeds process).

* just take 10 lines, don't be clever

Co-authored-by: Jamie Gaskins <jamie@forem.com>

Co-authored-by: Jamie Gaskins <jamie@forem.com>
This commit is contained in:
Daniel Uber 2021-09-08 17:54:53 -05:00 committed by GitHub
parent 61eed20876
commit 2a75ec8ecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -512,7 +512,7 @@ seeder.create_if_none(Listing) do
Listing.create!(
user: user,
title: Faker::Lorem.sentence,
body_markdown: Faker::Markdown.random,
body_markdown: Faker::Markdown.random.lines.take(10).join,
location: Faker::Address.city,
organization_id: user.organizations.first&.id,
listing_category_id: category_id,