test/highlight_test.rb in searchkick-1.0.3 vs test/highlight_test.rb in searchkick-1.1.0
- old
+ new
@@ -25,18 +25,20 @@
assert_equal nil, highlight[:color]
end
def test_field_options
store_names ["Two Door Cinema Club are a Northern Irish indie rock band"]
- assert_equal "Two Door <em>Cinema</em> Club are", Product.search("cinema", fields: [:name], highlight: {fields: {name: {fragment_size: 20}}}).with_details.first[1][:highlight][:name]
+ fragment_size = ENV["MATCH"] == "word_start" ? 26 : 20
+ assert_equal "Two Door <em>Cinema</em> Club are", Product.search("cinema", fields: [:name], highlight: {fields: {name: {fragment_size: fragment_size}}}).with_details.first[1][:highlight][:name]
end
def test_multiple_words
store_names ["Hello World Hello"]
assert_equal "<em>Hello</em> World <em>Hello</em>", Product.search("hello", fields: [:name], highlight: true).with_details.first[1][:highlight][:name]
end
def test_json
+ skip if ENV["MATCH"] == "word_start"
store_names ["Two Door Cinema Club"]
json = {
query: {
match: {
"name.analyzed" => "cinema"