From 9c186c92bc5d91a62a33b8b43a60a4f13967dc09 Mon Sep 17 00:00:00 2001 From: ellnix <103502144+ellnix@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:08:38 +0100 Subject: [PATCH] Fix linter problems --- lib/meilisearch/rails/multi_search.rb | 1 - spec/multi_search_spec.rb | 23 ++++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/meilisearch/rails/multi_search.rb b/lib/meilisearch/rails/multi_search.rb index 4126a40e..1f9b63bd 100644 --- a/lib/meilisearch/rails/multi_search.rb +++ b/lib/meilisearch/rails/multi_search.rb @@ -12,7 +12,6 @@ def multi_search(searches) MultiSearchResult.new(searches, client.multi_search(search_parameters)) end - private def normalize(options, index_target) diff --git a/spec/multi_search_spec.rb b/spec/multi_search_spec.rb index 552bf76d..c8f9ed17 100644 --- a/spec/multi_search_spec.rb +++ b/spec/multi_search_spec.rb @@ -4,26 +4,31 @@ def reset_indexes [Book, Color, Product].each do |klass| klass.delete_all - klass.clear_index! + klass.clear_index!(true) end end - before { reset_indexes } - - let!(:palm_pixi_plus) { Product.create!(name: 'palm pixi plus', href: 'ebay', tags: ['terrible']) } - let!(:steve_jobs) { Book.create! name: 'Steve Jobs', author: 'Walter Isaacson' } - let!(:blue) { Color.create!(name: 'blue', short_name: 'blu', hex: 0x0000FF) } - let!(:black) { Color.create!(name: 'black', short_name: 'bla', hex: 0x000000) } - before do + reset_indexes + + Product.create! name: 'palm pixi plus', href: 'ebay', tags: ['terrible'] Product.create! name: 'lg vortex', href: 'ebay', tags: ['decent'] Product.create! name: 'palmpre', href: 'ebay', tags: ['discontinued', 'worst phone ever'] Product.reindex! + Color.create! name: 'blue', short_name: 'blu', hex: 0x0000FF + Color.create! name: 'black', short_name: 'bla', hex: 0x000000 Color.create! name: 'green', short_name: 'gre', hex: 0x00FF00 + + Book.create! name: 'Steve Jobs', author: 'Walter Isaacson' Book.create! name: 'Moby Dick', author: 'Herman Melville' end + let!(:palm_pixi_plus) { Product.find_by name: 'palm pixi plus' } + let!(:steve_jobs) { Book.find_by name: 'Steve Jobs' } + let!(:blue) { Color.find_by name: 'blue' } + let!(:black) { Color.find_by name: 'black' } + context 'with class keys' do it 'returns ORM records' do results = MeiliSearch::Rails.multi_search( @@ -96,7 +101,7 @@ def reset_indexes end context 'with pagination' do - it 'it properly paginates each search' do + it 'properly paginates each search' do MeiliSearch::Rails.configuration[:pagination_backend] = :kaminari results = MeiliSearch::Rails.multi_search(