This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/spec/factories/writing_journal_files.rb

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