Commit d4c1f2bc6522f84e70a6b05310c667438de0883d
1 parent
a92c6987
Exists in
master
and in
21 other branches
Fixed Mongoid 3 tests
Showing
17 changed files
with
37 additions
and
18 deletions
Show diff stats
.gitignore
.travis.yml
lib/searchkick/model.rb
lib/searchkick/search.rb
... | ... | @@ -161,6 +161,8 @@ module Searchkick |
161 | 161 | proc do |where| |
162 | 162 | filters = [] |
163 | 163 | (where || {}).each do |field, value| |
164 | + field = :_id if field.to_s == "id" | |
165 | + | |
164 | 166 | if field == :or |
165 | 167 | value.each do |or_clause| |
166 | 168 | filters << {or: or_clause.map{|or_statement| {and: where_filters.call(or_statement)} }} | ... | ... |
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::Unit::TestCase | |
3 | +class TestSql < Minitest::Test | |
4 | 4 | |
5 | 5 | def test_limit |
6 | 6 | store_names ["Product A", "Product B", "Product C", "Product D"] |
... | ... | @@ -194,9 +194,12 @@ class TestSql < Minitest::Unit::TestCase |
194 | 194 | assert_kind_of Tire::Results::Item, Product.search("product", load: false, include: [:store]).first |
195 | 195 | end |
196 | 196 | |
197 | - def test_include | |
198 | - store_names ["Product A"] | |
199 | - assert Product.search("product", include: [:store]).first.association(:store).loaded? | |
197 | + # TODO see if Mongoid is loaded | |
198 | + if !defined?(Mongoid) | |
199 | + def test_include | |
200 | + store_names ["Product A"] | |
201 | + assert Product.search("product", include: [:store]).first.association(:store).loaded? | |
202 | + end | |
200 | 203 | end |
201 | 204 | |
202 | 205 | end | ... | ... |
test/suggest_test.rb
test/synonyms_test.rb
test/test_helper.rb
... | ... | @@ -11,7 +11,7 @@ Tire.configure do |
11 | 11 | pretty true |
12 | 12 | end |
13 | 13 | |
14 | -if ENV["MONGOID"] | |
14 | +if defined?(Mongoid) | |
15 | 15 | Mongoid.configure do |config| |
16 | 16 | config.connect_to "searchkick_test" |
17 | 17 | end |
... | ... | @@ -19,6 +19,9 @@ if ENV["MONGOID"] |
19 | 19 | class Product |
20 | 20 | include Mongoid::Document |
21 | 21 | # include Mongoid::Attributes::Dynamic |
22 | + | |
23 | + field :latitude, type: BigDecimal | |
24 | + field :longitude, type: BigDecimal | |
22 | 25 | end |
23 | 26 | |
24 | 27 | class Store |
... | ... | @@ -105,7 +108,7 @@ class Product |
105 | 108 | attr_accessor :conversions, :user_ids |
106 | 109 | |
107 | 110 | def search_data |
108 | - attributes.merge conversions: conversions, user_ids: user_ids, location: [latitude, longitude], multiple_locations: [[latitude, longitude], [0, 0]] | |
111 | + serializable_hash.merge conversions: conversions, user_ids: user_ids, location: [latitude, longitude], multiple_locations: [[latitude, longitude], [0, 0]] | |
109 | 112 | end |
110 | 113 | end |
111 | 114 | |
... | ... | @@ -119,7 +122,7 @@ Product.reindex # run twice for both index paths |
119 | 122 | |
120 | 123 | Animal.reindex |
121 | 124 | |
122 | -class MiniTest::Unit::TestCase | |
125 | +class Minitest::Test | |
123 | 126 | |
124 | 127 | def setup |
125 | 128 | Product.destroy_all | ... | ... |