Commit e1c350ba6c424767e12c8c1481bd7710da673ea2
1 parent
d474a69a
Exists in
master
and in
21 other branches
Fixes for Mongoid 4
Showing
17 changed files
with
35 additions
and
18 deletions
Show diff stats
.travis.yml
Gemfile
lib/searchkick/model.rb
... | ... | @@ -43,6 +43,9 @@ module Searchkick |
43 | 43 | # stringify fields |
44 | 44 | source = source.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo} |
45 | 45 | |
46 | + # Mongoid 4 hack | |
47 | + source["_id"] = source["_id"].to_s if source["_id"] | |
48 | + | |
46 | 49 | options = self.class.searchkick_options |
47 | 50 | |
48 | 51 | # conversions | ... | ... |
searchkick.gemspec
... | ... | @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| |
23 | 23 | |
24 | 24 | spec.add_development_dependency "bundler", "~> 1.3" |
25 | 25 | spec.add_development_dependency "rake" |
26 | - spec.add_development_dependency "minitest" | |
26 | + spec.add_development_dependency "minitest", "~> 4.7" | |
27 | 27 | spec.add_development_dependency "activerecord" |
28 | 28 | spec.add_development_dependency "pg" |
29 | 29 | end | ... | ... |
test/autocomplete_test.rb
test/boost_test.rb
test/facets_test.rb
test/highlight_test.rb
test/index_test.rb
test/inheritance_test.rb
test/match_test.rb
test/similar_test.rb
test/sql_test.rb
1 | 1 | require_relative "test_helper" |
2 | 2 | |
3 | -class TestSql < Minitest::Test | |
3 | +class TestSql < Minitest::Unit::TestCase | |
4 | 4 | |
5 | 5 | def test_limit |
6 | 6 | store_names ["Product A", "Product B", "Product C", "Product D"] |
... | ... | @@ -87,7 +87,7 @@ class TestSql < Minitest::Test |
87 | 87 | def test_where_id |
88 | 88 | store_names ["Product A"] |
89 | 89 | product = Product.last |
90 | - assert_search "product", ["Product A"], where: {id: product.id} | |
90 | + assert_search "product", ["Product A"], where: {id: product.id.to_s} | |
91 | 91 | end |
92 | 92 | |
93 | 93 | def test_near | ... | ... |
test/suggest_test.rb
test/synonyms_test.rb
test/test_helper.rb
... | ... | @@ -18,8 +18,15 @@ if defined?(Mongoid) |
18 | 18 | |
19 | 19 | class Product |
20 | 20 | include Mongoid::Document |
21 | - # include Mongoid::Attributes::Dynamic | |
22 | - | |
21 | + include Mongoid::Timestamps | |
22 | + | |
23 | + field :name | |
24 | + field :store_id, type: Integer | |
25 | + field :in_stock, type: Boolean | |
26 | + field :backordered, type: Boolean | |
27 | + field :orders_count, type: Integer | |
28 | + field :price, type: Integer | |
29 | + field :color | |
23 | 30 | field :latitude, type: BigDecimal |
24 | 31 | field :longitude, type: BigDecimal |
25 | 32 | end |
... | ... | @@ -30,6 +37,8 @@ if defined?(Mongoid) |
30 | 37 | |
31 | 38 | class Animal |
32 | 39 | include Mongoid::Document |
40 | + | |
41 | + field :name | |
33 | 42 | end |
34 | 43 | |
35 | 44 | class Dog < Animal |
... | ... | @@ -122,7 +131,7 @@ Product.reindex # run twice for both index paths |
122 | 131 | |
123 | 132 | Animal.reindex |
124 | 133 | |
125 | -class Minitest::Test | |
134 | +class Minitest::Unit::TestCase | |
126 | 135 | |
127 | 136 | def setup |
128 | 137 | Product.destroy_all | ... | ... |