Move factories to spec dir and add helper module

This commit is contained in:
Lars Henrik Mai 2016-02-19 08:39:30 +01:00
parent e351f12b3f
commit d9f95f9e97
2 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,5 @@
require_relative '../factory_helper'
FactoryGirl.define do FactoryGirl.define do
factory :paper do factory :paper do
name { Faker::Lorem.sentence } name { Faker::Lorem.sentence }
@ -6,7 +8,7 @@ FactoryGirl.define do
body "leipzig" body "leipzig"
published_at "2015-07-20 21:16:53" published_at "2015-07-20 21:16:53"
scraped_at "2015-07-20 21:16:53" scraped_at "2015-07-20 21:16:53"
paper_type "Verwaltungsstandpunkt" paper_type { FactoryHelper.paper_type }
originator { Faker::Name.name } originator { Faker::Name.name }
resolution { Faker::Lorem.paragraph(3) } resolution { Faker::Lorem.paragraph(3) }
content "-------------------------------\n\n " # oh well... content "-------------------------------\n\n " # oh well...

23
spec/factory_helper.rb Normal file
View file

@ -0,0 +1,23 @@
module FactoryHelper
PAPER_TYPES = [
"Verwaltungsstandpunkt",
"Anfrage",
"Beschlussvorlage",
"Änderungsantrag",
"Antrag",
"Neufassung",
"Informationsvorlage",
"Einwohneranfrage",
"Petition",
"schriftliche Antwort zur Anfrage",
"Wichtige Angelegenheit",
"Eilentscheidung",
"Dringliche Anfrage"
]
def self.paper_type
PAPER_TYPES.sample
end
end