Browse Source

Don't seed org in test

pull/610/head
baarkerlounger 3 years ago
parent
commit
35a4060c66
  1. 14
      db/seeds.rb

14
db/seeds.rb

@ -7,7 +7,8 @@
# Character.create(name: 'Luke', movie: movies.first) # Character.create(name: 'Luke', movie: movies.first)
# rubocop:disable Rails/Output # rubocop:disable Rails/Output
org = Organisation.find_or_create_by!( unless Rails.env.test?
org = Organisation.find_or_create_by!(
name: "DLUHC", name: "DLUHC",
address_line1: "2 Marsham Street", address_line1: "2 Marsham Street",
address_line2: "London", address_line2: "London",
@ -16,16 +17,16 @@ org = Organisation.find_or_create_by!(
other_stock_owners: "None", other_stock_owners: "None",
managing_agents: "None", managing_agents: "None",
provider_type: "LA", provider_type: "LA",
) do ) do
info = "Seeded DLUHC Organisation" info = "Seeded DLUHC Organisation"
if Rails.env.development? if Rails.env.development?
pp info pp info
else else
Rails.logger.info info Rails.logger.info info
end end
end end
if Rails.env.development? && User.count.zero? if Rails.env.development? && User.count.zero?
User.create!( User.create!(
email: "provider@example.com", email: "provider@example.com",
password: "password", password: "password",
@ -51,12 +52,13 @@ if Rails.env.development? && User.count.zero?
) )
pp "Seeded 3 dummy users" pp "Seeded 3 dummy users"
end end
if LaRentRange.count.zero? && !Rails.env.test? if LaRentRange.count.zero?
Dir.glob("config/rent_range_data/*.csv").each do |path| Dir.glob("config/rent_range_data/*.csv").each do |path|
start_year = File.basename(path, ".csv") start_year = File.basename(path, ".csv")
Rake::Task["data_import:rent_ranges"].invoke(start_year, path) Rake::Task["data_import:rent_ranges"].invoke(start_year, path)
end end
end
end end
# rubocop:enable Rails/Output # rubocop:enable Rails/Output

Loading…
Cancel
Save