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/co_authors.rb

23 lines
705 B
Ruby

CoAuthor.destroy_all
name_tw = Array.new 51,""
name_tw = name_tw.map do |p| Faker::Name::name end
name_en = Array.new 51,""
name_en = name_en.map do |p| Faker::Name::name end
email = Array.new 51,""
email= email.map do |p| Faker::Internet.email end
FactoryGirl.define do
factory(:co_author_candidate, class: "CoAuthor") do |f|
f.sequence(:co_author_translations) do |n|
{ zh_tw: "#{name_tw[n]}",
en: "#{name_en[n]}" }
end
f.sequence(:co_author_relations_id) do |n| "#{CoAuthorRelation.all[n%CoAuthorRelation.count].id}" end
f.sequence(:email) do |n| "#{email[n]}" end
f.name_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
end
end