modularize factories

This commit is contained in:
Rueshyna 2013-01-17 15:57:12 +08:00 committed by chris
parent 8f334f6948
commit 8e98aa10bc
6 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,11 @@
require 'factory_girl'
require 'faker'
FactoryGirl.definition_file_paths = Dir["#{Rails.root}/vendor/built_in_modules/*/spec/factories"]
FactoryGirl.find_definitions
CoAuthorRelation.destroy_all
CoAuthor.destroy_all
JournalLevelType.destroy_all
@ -8,7 +13,8 @@ WritingJournalFile.destroy_all
WritingJournal.destroy_all
#Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
10.times do
10.size.times do
FactoryGirl.create(:journal_level)
end

View File

@ -1,6 +1,5 @@
level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"]
FactoryGirl.define do
factory(:journal_level, class: "JournalLevelType") do |f|
f.sequence(:title_translations) do |n|