lib/decidim/meetings/component.rb in decidim-meetings-0.26.10 vs lib/decidim/meetings/component.rb in decidim-meetings-0.27.0.rc1
- old
+ new
@@ -125,11 +125,11 @@
scopes = participatory_space.organization.scopes
global = nil
end
2.times do
- start_time = Faker::Date.between(from: 20.weeks.ago, to: 20.weeks.from_now)
+ start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
end_time = start_time + [rand(1..4).hours, rand(1..20).days].sample
params = {
component: component,
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
category: participatory_space.categories.sample,
@@ -205,12 +205,12 @@
email = "meeting-registered-user-#{meeting.id}-#{n}@example.org"
name = "#{Faker::Name.name} #{meeting.id} #{n}"
user = Decidim::User.find_or_initialize_by(email: email)
user.update!(
- password: "decidim123456",
- password_confirmation: "decidim123456",
+ password: "decidim123456789",
+ password_confirmation: "decidim123456789",
name: name,
nickname: Faker::Twitter.unique.screen_name,
organization: component.organization,
tos_agreement: "1",
confirmed_at: Time.current,
@@ -234,11 +234,11 @@
title: Decidim::Faker::Localized.sentence(word_count: 2),
description: Decidim::Faker::Localized.sentence(word_count: 5),
attachment_collection: attachment_collection,
attached_to: meeting,
content_type: "application/pdf",
- file: ActiveStorage::Blob.create_after_upload!(
+ file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
metadata: nil
) # Keep after attached_to
@@ -246,11 +246,11 @@
Decidim::Attachment.create!(
title: Decidim::Faker::Localized.sentence(word_count: 2),
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: meeting,
content_type: "image/jpeg",
- file: ActiveStorage::Blob.create_after_upload!(
+ file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg",
metadata: nil
) # Keep after attached_to
@@ -258,11 +258,11 @@
Decidim::Attachment.create!(
title: Decidim::Faker::Localized.sentence(word_count: 2),
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: meeting,
content_type: "application/pdf",
- file: ActiveStorage::Blob.create_after_upload!(
+ file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
metadata: nil
) # Keep after attached_to
@@ -280,10 +280,10 @@
if author.is_a?(Decidim::UserGroup)
user_group = author
author = user_group.users.sample
end
- start_time = Faker::Date.between(from: 20.weeks.ago, to: 20.weeks.from_now)
+ start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
params = {
component: component,
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
category: participatory_space.categories.sample,
title: Decidim::Faker::Localized.sentence(word_count: 2),