spec/spec_helper.rb in search_flip-3.9.0 vs spec/spec_helper.rb in search_flip-4.0.0.beta
- old
+ new
@@ -14,12 +14,10 @@
config.before do
TestIndex.delete_index if TestIndex.index_exists?
ProductIndex.match_all.delete
Product.delete_all
- CommentIndex.match_all.delete
- Comment.delete_all
end
end
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
@@ -84,11 +82,11 @@
class CommentIndex
include SearchFlip::Index
def self.type_name
- connection.distribution.nil? && connection.version.to_i < 8 ? "comments" : "_doc"
+ "comments"
end
def self.index_name
"comments"
end
@@ -111,11 +109,11 @@
class ProductIndex
include SearchFlip::Index
def self.mapping
- if ProductIndex.connection.distribution || ProductIndex.connection.version.to_i >= 5
+ if ProductIndex.connection.version.to_i >= 5
{
properties: {
category: {
type: "text",
fielddata: true
@@ -134,11 +132,11 @@
{}
end
end
def self.type_name
- connection.distribution.nil? && connection.version.to_i < 8 ? "products" : "_doc"
+ "products"
end
def self.index_name
"products"
end
@@ -175,10 +173,10 @@
}
}
end
def self.type_name
- connection.distribution.nil? && connection.version.to_i < 8 ? "test" : "_doc"
+ "test"
end
def self.index_name
"test"
end