Commit 5c3b34b9408ef4a5134e544da4e113d4e5fb9835
1 parent
9d067a77
Exists in
master
and in
21 other branches
Add Results#entry_name method for kaminari compatibility
From kaminari 0.16.0, `page_entries_info` requires paginatable objects to have `#entry_name` method. SearchKick::Results class should also have it so it'll play nice together with kaminari.
Showing
3 changed files
with
7 additions
and
0 deletions
Show diff stats
lib/searchkick/results.rb
test/sql_test.rb
... | ... | @@ -22,6 +22,7 @@ class TestSql < Minitest::Test |
22 | 22 | store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] |
23 | 23 | products = Product.search("product", order: {name: :asc}, page: 2, per_page: 2, padding: 1) |
24 | 24 | assert_equal ["Product D", "Product E"], products.map(&:name) |
25 | + assert_equal "product", products.entry_name | |
25 | 26 | assert_equal 2, products.current_page |
26 | 27 | assert_equal 1, products.padding |
27 | 28 | assert_equal 2, products.per_page | ... | ... |
test/test_helper.rb
... | ... | @@ -11,6 +11,8 @@ Minitest::Test = Minitest::Unit::TestCase unless defined?(Minitest::Test) |
11 | 11 | File.delete("elasticsearch.log") if File.exists?("elasticsearch.log") |
12 | 12 | Searchkick.client.transport.logger = Logger.new("elasticsearch.log") |
13 | 13 | |
14 | +I18n.config.enforce_available_locales = true | |
15 | + | |
14 | 16 | if defined?(Mongoid) |
15 | 17 | |
16 | 18 | def mongoid2? | ... | ... |