internetee-registry/spec/factories/domain.rb
Artur Beljajev 2da578a437 Migrate fabricators to factory bot factories (#626)
* Remove factory_girl include from dev rake task

No longer needed after 92b125b4a7

* Add missing factories

* Use FactoryBot factories instead of fabricators

* Remove all fabricators

* Remove unused method

* Remove fabrication gem

* Rename FactoryGirl to FactoryBot

https://robots.thoughtbot.com/factory_bot
2017-11-16 10:18:53 +02:00

23 lines
545 B
Ruby

FactoryBot.define do
factory :domain do
sequence(:name) { |n| "test#{n}.com" }
period 1
period_unit 'y' # Year
registrar
registrant
after :build do |domain|
domain.admin_domain_contacts << FactoryBot.build(:admin_domain_contact)
domain.tech_domain_contacts << FactoryBot.build(:tech_domain_contact)
end
factory :domain_without_force_delete do
force_delete_time nil
statuses []
end
factory :domain_discarded do
statuses [DomainStatus::DELETE_CANDIDATE]
end
end
end