orbit-personaljournal/spec/factories/writing_journal_files.rb

19 lines
457 B
Ruby
Raw Normal View History

2014-01-15 10:52:45 +00:00
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