20 lines
488 B
Ruby
20 lines
488 B
Ruby
WritingJournalFile.destroy_all
|
|
|
|
file_desc = Array.new 7, ""
|
|
file_desc = file_desc.map do |p| Faker::Lorem.word end
|
|
|
|
file = ["1.png", "5.pdf", "2.png", "6.pdf", "3.png", "7.pdf", "4.png"]
|
|
|
|
rand = Random.new
|
|
|
|
FactoryGirl.define do
|
|
factory(:upload_file, class: "WritingJournalFile") do |f|
|
|
f.sequence(:file) do |n|
|
|
File.new(File.join(Rails.root, "db" ,"files", file[rand.rand(0..6)]))
|
|
end
|
|
f.sequence(:title) do |n|
|
|
"#{file_desc[rand.rand(0..6)]}"
|
|
end
|
|
end
|
|
end
|