Sha256: d69edd2ac75f7d54a117ec265c4512b8d2340641a6bdf0e71b57d36f75a537c0
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require 'helper' class AxleAttributes::Definition::IndexedTest < ActiveSupport::TestCase class TestModel class << self def name 'TestModel' end end end test 'analyzer_mapping' do assert_equal({type: "string", analyzer: :snowball}, AxleAttributes::Definition.new(TestModel, :name, index: :snowball).analyzer_mapping) assert_equal({type: "string", analyzer: :simple}, AxleAttributes::Definition.new(TestModel, :name, index: :simple).analyzer_mapping) assert_nil AxleAttributes::Definition.new(TestModel, :foo).analyzer_mapping end test 'index_mapping' do assert_nil build_mapping(type: :string, index: false) assert_equal( {type: "geo_point", lat_lon: true}, build_mapping(type: false, index: {type: "geo_point", lat_lon: true}) ) assert_equal( {type: "boolean", doc_values: true}, build_mapping(type: :boolean, index: true) ) assert_equal( {type: "date", format: "date", doc_values: true}, build_mapping(type: :date, index: true) ) assert_equal( {type: "string", index_analyzer: "keyword", search_analyzer: "standard"}, build_mapping(type: :string, index: true) ) assert_equal( {type: "multi_field", fields: {'foo'=> {type: "string", index: "not_analyzed", doc_values: true}, analyzed: {type: "string", analyzer: :snowball}}}, build_mapping(type: :string, index: :snowball) ) assert_equal( {type: "multi_field", fields: {'foo' => {type: "string", index: "not_analyzed", doc_values: true}, analyzed: {type: "string", analyzer: :simple}}}, build_mapping(type: :string, index: :simple) ) end private def build_mapping(options) AxleAttributes::Definition.new(TestModel, :foo, options).index_mapping end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axle_attributes-1.13.2 | test/lib/definition/indexed_test.rb |