From 8158ea3cd293316dfcacd9ed31a0cabe3bd48094 Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Mon, 14 Jun 2021 09:55:12 -0500 Subject: [PATCH] Use a counter and append the index to make sure slugs are unique (#13981) There's a unique index page on slugs that failed today during a PR merge, where 'et' was the `Faker::Lorem.word` selected both times. Add a suffix to the generated word to ensure these are unique and an index collision doesn't happen. --- spec/support/seeds/seeds_e2e.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/support/seeds/seeds_e2e.rb b/spec/support/seeds/seeds_e2e.rb index 0943f6d51..adc03bb95 100644 --- a/spec/support/seeds/seeds_e2e.rb +++ b/spec/support/seeds/seeds_e2e.rb @@ -234,9 +234,9 @@ end ############################################################################## seeder.create_if_none(Page) do - 2.times do + 2.times do |t| Page.create!( - slug: Faker::Lorem.word, + slug: "#{Faker::Lorem.word}-#{t}", body_html: "

#{Faker::Hipster.paragraph(sentence_count: 2)}

", title: "#{Faker::Lorem.word} #{rand(100)}", description: "A test page",