current version
This commit is contained in:
parent
9e3fdcd868
commit
7a412d4e7e
12
db/seeds.rb
12
db/seeds.rb
|
@ -28,6 +28,8 @@ file = ["1.png", "5.pdf", "2.png", "6.pdf", "3.png", "7.pdf", "4.png"]
|
|||
|
||||
level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"]
|
||||
|
||||
rand = Random.new
|
||||
|
||||
FactoryGirl.define do
|
||||
factory(:journal_level, class: "JournalLevelType") do |f|
|
||||
f.sequence(:title_translations) do |n|
|
||||
|
@ -38,10 +40,10 @@ FactoryGirl.define do
|
|||
|
||||
factory(:upload_file, class: "WritingJournalFile") do |f|
|
||||
f.sequence(:file) do |n|
|
||||
File.new(File.join(Rails.root, "db" ,"files", file[Random.rand(0..6)]))
|
||||
File.new(File.join(Rails.root, "db" ,"files", file[rand.rand(0..6)]))
|
||||
end
|
||||
f.sequence(:title) do |n|
|
||||
"#{file_desc[Random.rand(0..6)]}"
|
||||
"#{file_desc[rand.rand(0..6)]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -112,16 +114,16 @@ FactoryGirl.define do
|
|||
|
||||
f.sequence(:journal_level_types) do |n|
|
||||
level = []
|
||||
total_levels = Random.rand(1..JournalLevelType.count)
|
||||
total_levels = rand.rand(1..JournalLevelType.count)
|
||||
total_levels.times do
|
||||
level << JournalLevelType.all[Random.rand(0..JournalLevelType.count-1)]
|
||||
level << JournalLevelType.all[rand.rand(0..JournalLevelType.count-1)]
|
||||
end
|
||||
level.uniq
|
||||
end
|
||||
|
||||
f.sequence(:writing_journal_files) do |n|
|
||||
files = []
|
||||
total_files = Random.rand(1..7)
|
||||
total_files = rand.rand(1..7)
|
||||
total_files.times do files << FactoryGirl.create(:upload_file) end
|
||||
files
|
||||
end
|
||||
|
|
Reference in New Issue