From c4cb2ecd2e5146b1ad0df9fb42f8a6fa18f4854a Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:46:23 +0000 Subject: [PATCH] Seed la data before links (#1435) * seed la data before links * lint * Only seed LAs once for tests --- db/seeds.rb | 6 ++++++ spec/spec_helper.rb | 3 +++ 2 files changed, 9 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index f57bb85d7..bf43d47b1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -309,6 +309,12 @@ unless Rails.env.test? pp "Seeded 3 dummy schemes" end + if LocalAuthority.count.zero? + la_path = "config/local_authorities_data/initial_local_authorities.csv" + service = Imports::LocalAuthoritiesService.new(path: la_path) + service.call + end + if (Rails.env.development? || Rails.env.review?) && LocalAuthorityLink.count.zero? links_data_path = "config/local_authorities_data/local_authority_links_2023.csv" service = Imports::LocalAuthorityLinksService.new(path: links_data_path) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 72083e6a9..9677a128c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -113,6 +113,9 @@ RSpec.configure do |config| config.before do RequestHelper.stub_http_requests + end + + config.before(:suite) do Rails.application.load_seed end