Commit a369385369f17a13622e4d5db36ed717bdcfac1e

Authored by Andrew Kane
1 parent 0e718b72

Improved test times for some files [skip ci]

Showing 2 changed files with 13 additions and 10 deletions   Show diff stats
test/support/helpers.rb
@@ -2,6 +2,19 @@ class Minitest::Test @@ -2,6 +2,19 @@ class Minitest::Test
2 include ActiveJob::TestHelper 2 include ActiveJob::TestHelper
3 3
4 def setup 4 def setup
  5 + $setup_once ||= begin
  6 + # TODO improve
  7 + Product.searchkick_index.delete if Product.searchkick_index.exists?
  8 + Product.reindex
  9 + Product.reindex # run twice for both index paths
  10 + Product.create!(name: "Set mapping")
  11 +
  12 + Store.reindex
  13 + Animal.reindex
  14 + Speaker.reindex
  15 + Region.reindex
  16 + end
  17 +
5 Product.destroy_all 18 Product.destroy_all
6 Store.destroy_all 19 Store.destroy_all
7 Animal.destroy_all 20 Animal.destroy_all
test/test_helper.rb
@@ -51,14 +51,4 @@ Dir["#{__dir__}/models/*"].each do |file| @@ -51,14 +51,4 @@ Dir["#{__dir__}/models/*"].each do |file|
51 require file 51 require file
52 end 52 end
53 53
54 -Product.searchkick_index.delete if Product.searchkick_index.exists?  
55 -Product.reindex  
56 -Product.reindex # run twice for both index paths  
57 -Product.create!(name: "Set mapping")  
58 -  
59 -Store.reindex  
60 -Animal.reindex  
61 -Speaker.reindex  
62 -Region.reindex  
63 -  
64 require_relative "support/helpers" 54 require_relative "support/helpers"