test/test_helper.rb in searchkick-1.2.0 vs test/test_helper.rb in searchkick-1.2.1
- old
+ new
@@ -2,10 +2,11 @@
Bundler.require(:default)
require "minitest/autorun"
require "minitest/pride"
require "logger"
require "active_support/core_ext" if defined?(NoBrainer)
+require "active_support/notifications"
ENV["RACK_ENV"] = "test"
Minitest::Test = Minitest::Unit::TestCase unless defined?(Minitest::Test)
@@ -16,10 +17,11 @@
puts "Running against Elasticsearch #{Searchkick.server_version}"
I18n.config.enforce_available_locales = true
ActiveJob::Base.logger = nil if defined?(ActiveJob)
+ActiveSupport::LogSubscriber.logger = Logger.new(STDOUT) if ENV["NOTIFICATIONS"]
def elasticsearch2?
Searchkick.server_version.starts_with?("2.")
end
@@ -242,18 +244,26 @@
end
end
class Store
searchkick \
- routing: elasticsearch2? ? false : "name",
+ routing: true,
merge_mappings: true,
mappings: {
store: {
properties: {
name: {type: "string", analyzer: "keyword"}
}
}
}
+
+ def search_document_id
+ id
+ end
+
+ def search_routing
+ name
+ end
end
class Animal
searchkick \
autocomplete: [:name],