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

19 lines
457 B
Ruby
Raw Normal View History

2012-12-06 14:05:22 +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