From cb2c6835c4cec404d9bf82f2b37fe3d01a653f34 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 27 Sep 2021 12:38:31 +1000 Subject: [PATCH] Standardise default country and state The OFN software was first written in Melbourne and a lot of spec code relies on the state Victoria being in the database. When we imported Spree code, it came with its default state Alabame in the USA. Having two different defaults is confusing and caused specs to fail in rare circumstances. Let's standardise it here which will also open the path to removing the seeding of test data and the exclusion of states and countries in the database cleaner. --- spec/factories/country_factory.rb | 10 +++++----- spec/factories/state_factory.rb | 12 +++--------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/spec/factories/country_factory.rb b/spec/factories/country_factory.rb index 6a05f63e58..9149be3453 100644 --- a/spec/factories/country_factory.rb +++ b/spec/factories/country_factory.rb @@ -2,10 +2,10 @@ FactoryBot.define do factory :country, class: Spree::Country do - iso_name { 'UNITED STATES' } - name { 'United States of America' } - iso { 'US' } - iso3 { 'USA' } - numcode { 840 } + iso_name { "AUSTRALIA" } + name { "Australia" } + iso { "AU" } + iso3 { "AUS" } + numcode { 36 } end end diff --git a/spec/factories/state_factory.rb b/spec/factories/state_factory.rb index 6e8eb57a0e..307f828eb4 100644 --- a/spec/factories/state_factory.rb +++ b/spec/factories/state_factory.rb @@ -2,14 +2,8 @@ FactoryBot.define do factory :state, class: Spree::State do - name { 'Alabama' } - abbr { 'AL' } - country do |country| - if usa = Spree::Country.find_by(numcode: 840) - country = usa - else - country.association(:country) - end - end + name { "Victoria" } + abbr { "Vic" } + country end end