modularize factories
This commit is contained in:
parent
8f334f6948
commit
8e98aa10bc
|
@ -1,6 +1,11 @@
|
||||||
require 'factory_girl'
|
require 'factory_girl'
|
||||||
require 'faker'
|
require 'faker'
|
||||||
|
|
||||||
|
FactoryGirl.definition_file_paths = Dir["#{Rails.root}/vendor/built_in_modules/*/spec/factories"]
|
||||||
|
|
||||||
|
FactoryGirl.find_definitions
|
||||||
|
|
||||||
|
|
||||||
CoAuthorRelation.destroy_all
|
CoAuthorRelation.destroy_all
|
||||||
CoAuthor.destroy_all
|
CoAuthor.destroy_all
|
||||||
JournalLevelType.destroy_all
|
JournalLevelType.destroy_all
|
||||||
|
@ -8,7 +13,8 @@ WritingJournalFile.destroy_all
|
||||||
WritingJournal.destroy_all
|
WritingJournal.destroy_all
|
||||||
#Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
|
#Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
|
||||||
|
|
||||||
10.times do
|
|
||||||
|
10.size.times do
|
||||||
FactoryGirl.create(:journal_level)
|
FactoryGirl.create(:journal_level)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"]
|
level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"]
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory(:journal_level, class: "JournalLevelType") do |f|
|
factory(:journal_level, class: "JournalLevelType") do |f|
|
||||||
f.sequence(:title_translations) do |n|
|
f.sequence(:title_translations) do |n|
|
Reference in New Issue