test/highlight_test.rb in searchkick-0.7.8 vs test/highlight_test.rb in searchkick-0.7.9

- old
+ new

@@ -17,6 +17,25 @@ highlight = Product.search("cinema", fields: [:name, :color], highlight: true).with_details.first[1][:highlight] assert_equal "Two Door <em>Cinema</em> Club", highlight[:name] assert_equal "<em>Cinema</em> Orange", highlight[:color] end + def test_json + store_names ["Two Door Cinema Club"] + json = { + query: { + match: { + _all: "cinema" + } + }, + highlight: { + pre_tags: ["<strong>"], + post_tags: ["</strong>"], + fields: { + "name.analyzed" => {} + } + } + } + assert_equal "Two Door <strong>Cinema</strong> Club", Product.search(json: json).with_details.first[1][:highlight][:"name.analyzed"] + end + end