Commit 807142dacc56ef11c9488d76d935645c127856b9

Authored by Andrew Kane
2 parents 9d067a77 5c3b34b9

Merge branch 'yuki24-add-entry-name-to-results-class'

lib/searchkick/results.rb
... ... @@ -88,6 +88,10 @@ module Searchkick
88 88 klass.model_name
89 89 end
90 90  
  91 + def entry_name
  92 + model_name.human.downcase
  93 + end
  94 +
91 95 def total_count
92 96 response["hits"]["total"]
93 97 end
... ...
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?
... ...