test/test_helper.rb in searchkick-2.3.0 vs test/test_helper.rb in searchkick-2.3.1

- old
+ new

@@ -109,10 +109,16 @@ class Dog < Animal end class Cat < Animal end + + class Sku + include Mongoid::Document + + field :name + end elsif defined?(NoBrainer) NoBrainer.configure do |config| config.app_name = :searchkick config.environment = :test end @@ -169,10 +175,17 @@ class Dog < Animal end class Cat < Animal end + + class Sku + include NoBrainer::Document + + field :id, type: String + field :name, type: String + end elsif defined?(Cequel) cequel = Cequel.connect( host: "127.0.0.1", port: 9042, @@ -250,10 +263,17 @@ end class Cat < Animal end + class Sku + include Cequel::Record + + key :id, :uuid + column :name, :text + end + [Product, Store, Region, Speaker, Animal].each(&:synchronize_schema) else require "active_record" # for debugging @@ -337,10 +357,14 @@ ActiveRecord::Migration.create_table :animals do |t| t.string :name t.string :type end + ActiveRecord::Migration.create_table :skus, id: :uuid do |t| + t.string :name + end + class Product < ActiveRecord::Base belongs_to :store end class Store < ActiveRecord::Base @@ -359,10 +383,13 @@ class Dog < Animal end class Cat < Animal end + + class Sku < ActiveRecord::Base + end end class Product searchkick \ synonyms: [ @@ -475,10 +502,14 @@ index_name: -> { "#{name.tableize}-#{Date.today.year}#{Searchkick.index_suffix}" }, callbacks: defined?(ActiveJob) ? :async : true # wordnet: true end +class Sku + searchkick callbacks: defined?(ActiveJob) ? :async : true +end + Product.searchkick_index.delete if Product.searchkick_index.exists? Product.reindex Product.reindex # run twice for both index paths Product.create!(name: "Set mapping") @@ -491,9 +522,10 @@ def setup Product.destroy_all Store.destroy_all Animal.destroy_all Speaker.destroy_all + Sku.destroy_all end protected def store(documents, klass = Product)