mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
Generate unique reference in Paper factory
This commit is contained in:
parent
9423847cb1
commit
aa4a6b6958
2 changed files with 7 additions and 1 deletions
|
@ -4,7 +4,7 @@ FactoryGirl.define do
|
||||||
factory :paper do
|
factory :paper do
|
||||||
name { Faker::Lorem.sentence }
|
name { Faker::Lorem.sentence }
|
||||||
url { Faker::Internet.url("ris.example.org") }
|
url { Faker::Internet.url("ris.example.org") }
|
||||||
reference "MyString"
|
sequence(:reference) { |n| FactoryHelper.reference(n) }
|
||||||
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"
|
||||||
|
|
|
@ -20,4 +20,10 @@ module FactoryHelper
|
||||||
PAPER_TYPES.sample
|
PAPER_TYPES.sample
|
||||||
end
|
end
|
||||||
|
|
||||||
|
REFERENCE = "A-%05i/16"
|
||||||
|
|
||||||
|
def self.reference(seq)
|
||||||
|
REFERENCE % seq
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue