From 02bd924e6a48c2fb6eb23566d9ef72315dbb5e14 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 6 Dec 2018 05:52:59 +0500 Subject: [PATCH] Fix factory "country_state" --- factories/country_states.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/factories/country_states.rb b/factories/country_states.rb index cb6d67b..d4b08a2 100644 --- a/factories/country_states.rb +++ b/factories/country_states.rb @@ -2,6 +2,10 @@ FactoryBot.define do factory :country_state do - name { Faker::Address.unique.state } + initialize_with do + CountryState.find_or_initialize_by name: name + end + + name { Faker::Address.state } end end