1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/factories/federal_subjects.rb

44 lines
999 B
Ruby
Raw Normal View History

2018-11-30 11:24:05 -05:00
# frozen_string_literal: true
FactoryBot.define do
2019-06-23 11:59:44 -04:00
factory :federal_subject do
2019-10-21 03:15:08 -04:00
initialize_with do
FederalSubject.find_or_initialize_by(
number: number,
english_name: english_name,
native_name: native_name,
)
end
2019-08-14 09:54:27 -04:00
number { rand 1..2**31 - 1 }
2019-08-14 09:54:27 -04:00
english_name do
2019-04-28 08:48:51 -04:00
I18n.with_locale :en do
2019-08-14 09:54:27 -04:00
"#{Faker::Address.state} #{number}"
2019-04-28 08:48:51 -04:00
end
end
2019-03-24 17:13:56 -04:00
native_name { english_name }
2019-07-19 18:52:14 -04:00
2019-07-22 05:14:14 -04:00
centre { Faker::Address.city }
2019-07-19 22:40:56 -04:00
timezone { "#{[nil, :-].sample}#{rand(0..11).to_s.rjust(2, '0')}:00:00" }
2018-11-30 11:24:05 -05:00
end
2019-10-21 03:15:08 -04:00
factory :moscow_federal_subject, parent: :federal_subject do
number { 77 }
english_name { 'Moscow' }
native_name { 'Москва' }
centre { 'Москва' }
timezone { '03:00:00' }
end
factory :perm_federal_subject, parent: :federal_subject do
number { 27 }
english_name { 'Perm Krai' }
native_name { 'Пермский край' }
centre { 'Пермь' }
timezone { '05:00:00' }
end
2018-11-30 11:24:05 -05:00
end