mongoid-elasticsearch 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4454671c943c79d336b9168b45489f56f15003e9
4
- data.tar.gz: 85177ec0a09180202a6806dcdb109a97bf695372
3
+ metadata.gz: 6ab2a507244af6596bf9c5770642ff8e0437018d
4
+ data.tar.gz: 7cc3aa09ebab9cf69d471ddab31ec2f3f6e041ad
5
5
  SHA512:
6
- metadata.gz: bf7055626940afc1012839353043a415248550a348db6f14dc3b22d1b83b8044a96da62c1a09c0c0f118221fda3d1fd41099325257800ae8883acc6628c61fcc
7
- data.tar.gz: d9ccd3b35a09e281aa2059abda0a91c2fc80eb32c729ab019e35bef50341a45ca05469f0a1f8fd0138660c4310f241989c5321cef5226ec72301ed08744c6426
6
+ metadata.gz: a3f54a1d33748829d1bd94f5ac9c05ffb0c926a217e2568de570a45225cff7bf30a53a964c9bed295c2391fb679706196e76338137b90110bf0f2d12ef7679fa
7
+ data.tar.gz: e878bfa26f9274669d554914be9a462d34f0d55dc607ea48aa4c875a4bd2cc4471ae28f4038a8692444294a3160fd686b01cb3b3ed0e08308c8ea3b6209adc7c
@@ -1 +1 @@
1
- 2.1.1
1
+ 2.1.2
@@ -54,7 +54,7 @@ module Mongoid
54
54
  end
55
55
 
56
56
  def last_page?
57
- current_page == total_pages
57
+ total_pages == 0 || current_page == total_pages
58
58
  end
59
59
 
60
60
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Elasticsearch
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
  end
5
5
  end
@@ -4,27 +4,27 @@ require "spec_helper"
4
4
 
5
5
  describe Article do
6
6
  it 'properly uses options' do
7
- Article.es_index_name.should eq 'mongoid_es_news'
8
- Article.es.index.name.should eq 'mongoid_es_news'
9
- Article.es.index.type.should eq 'article'
10
- Article.es_wrapper.should eq :load
11
- Article.es_client_options.should eq(DEFAULT_OPT)
7
+ expect(Article.es_index_name).to eq 'mongoid_es_news'
8
+ expect(Article.es.index.name).to eq 'mongoid_es_news'
9
+ expect(Article.es.index.type).to eq 'article'
10
+ expect(Article.es_wrapper).to eq :load
11
+ expect(Article.es_client_options).to eq(DEFAULT_OPT)
12
12
  end
13
13
 
14
14
  context 'index operations' do
15
15
  it 'creates and destroys index' do
16
- Article.es.index.exists?.should be_true
16
+ expect(Article.es.index.exists?).to be_truthy
17
17
  Article.es.index.delete
18
- Article.es.index.exists?.should be_false
18
+ expect(Article.es.index.exists?).to be_falsey
19
19
  Article.es.index.create
20
- Article.es.index.exists?.should be_true
20
+ expect(Article.es.index.exists?).to be_truthy
21
21
  end
22
22
  end
23
23
 
24
24
  context 'adding to index' do
25
25
  it 'successfuly saves mongoid document' do
26
26
  article = Article.new(name: 'test article name')
27
- article.save.should be_true
27
+ expect(article.save).to be_truthy
28
28
  end
29
29
  end
30
30
 
@@ -32,11 +32,11 @@ describe Article do
32
32
  it 'deletes document from index when model is destroyed' do
33
33
  Article.create(name: 'test article name')
34
34
  Article.es.index.refresh
35
- Article.es.all.count.should eq 1
35
+ expect(Article.es.all.count).to eq 1
36
36
 
37
37
  Article.first.destroy
38
38
  Article.es.index.refresh
39
- Article.es.all.count.should eq 0
39
+ expect(Article.es.all.count).to eq 0
40
40
  end
41
41
  end
42
42
 
@@ -60,22 +60,22 @@ describe Article do
60
60
 
61
61
  it 'searches and returns models' do
62
62
  results = Article.es.search q: 'likely'
63
- results.count.should eq 1
64
- results.to_a.count.should eq 1
65
- results.first.id.should eq @article_2.id
66
- results.first.name.should eq @article_2.name
63
+ expect(results.count).to eq 1
64
+ expect(results.to_a.count).to eq 1
65
+ expect(results.first.id).to eq @article_2.id
66
+ expect(results.first.name).to eq @article_2.name
67
67
  end
68
68
 
69
69
  it 'mongoid_slug with wrapper: :load' do
70
70
  results = Article.es.search q: 'likely'
71
71
  expect(Article).to receive(:find).once.with([@article_2.id.to_s]).and_call_original
72
- results.first.slug.should eq @article_2.name.to_url
73
- results.first.to_param.should eq @article_2.name.to_url
72
+ expect(results.first.slug).to eq @article_2.name.to_url
73
+ expect(results.first.to_param).to eq @article_2.name.to_url
74
74
  end
75
75
 
76
76
  it 'mongoid_slug with sort and wrapper: :load' do
77
77
  results = Article.es.search body: { query: { match_all: {} }, sort: { 'name.raw' => 'desc' } }
78
- results.map( &:id ).should eq Article.all.desc( :name ).map( &:id )
78
+ expect(results.map( &:id )).to eq Article.all.desc( :name ).map( &:id )
79
79
  end
80
80
 
81
81
  it 'mongoid_slug with wrapper: :model' do
@@ -83,26 +83,26 @@ describe Article do
83
83
  results = Article.es.search 'likely', wrapper: :model
84
84
  sleep 3
85
85
  allow(Article).to receive(:find)
86
- results.first.slug.should eq @article_2.name.to_url
87
- results.first.to_param.should eq @article_2.name.to_url
86
+ expect(results.first.slug).to eq @article_2.name.to_url
87
+ expect(results.first.to_param).to eq @article_2.name.to_url
88
88
  expect(Article).to_not have_received(:find)
89
89
  end
90
90
 
91
91
  it 'restores BSON::ObjectId with wrapper :model' do
92
92
  results = Post.es.search 'object_id'
93
93
  if defined?(Moped::BSON)
94
- results.first.my_object_id.should be_kind_of(Moped::BSON::ObjectId)
94
+ expect(results.first.my_object_id).to be_kind_of(Moped::BSON::ObjectId)
95
95
  else
96
- results.first.my_object_id.should be_kind_of(BSON::ObjectId)
96
+ expect(results.first.my_object_id).to be_kind_of(BSON::ObjectId)
97
97
  end
98
98
 
99
- results.first.my_object_id.should eq(@post_1.my_object_id)
99
+ expect(results.first.my_object_id).to eq(@post_1.my_object_id)
100
100
  end
101
101
 
102
102
 
103
103
  if Article.es.completion_supported?
104
104
  it 'completion' do
105
- Article.es.completion('te', 'name.suggest').should eq [
105
+ expect(Article.es.completion('te', 'name.suggest')).to eq [
106
106
  {"text"=>"test article name likes", "score"=>1.0},
107
107
  {"text"=>"tests likely an another article title", "score"=>1.0}
108
108
  ]
@@ -121,35 +121,49 @@ describe Article do
121
121
  end
122
122
 
123
123
  it '#search' do
124
- Article.es.search('test', per_page: 7, page: 2).to_a.size.should eq 3
124
+ expect(Article.es.search('test', per_page: 7, page: 2).to_a.size).to eq 3
125
+ end
126
+
127
+ it 'paging works with empty results' do
128
+ result = Article.es.search('bad_request', per_page: 7, page: 1)
129
+ p result
130
+ expect(result.num_pages).to eq 0
131
+ expect(result.current_page).to eq 1
132
+ expect(result.total_entries).to eq 0
133
+ expect(result.previous_page).to be_nil
134
+ expect(result.next_page).to be_nil
135
+ expect(result.to_a.size).to eq 0
136
+ expect(result.out_of_bounds?).to be_truthy
137
+ expect(result.first_page?).to be_truthy
138
+ expect(result.last_page?).to be_truthy
125
139
  end
126
140
 
127
141
  it '#all' do
128
142
  result = Article.es.all(per_page: 7, page: 2)
129
- result.num_pages.should eq 2
130
- result.current_page.should eq 2
131
- result.total_entries.should eq 10
132
- result.previous_page.should eq 1
133
- result.next_page.should be_nil
134
- result.to_a.size.should eq 3
135
- result.out_of_bounds?.should be_false
136
- result.first_page?.should be_false
137
- result.last_page?.should be_true
143
+ expect(result.num_pages).to eq 2
144
+ expect(result.current_page).to eq 2
145
+ expect(result.total_entries).to eq 10
146
+ expect(result.previous_page).to eq 1
147
+ expect(result.next_page).to be_nil
148
+ expect(result.to_a.size).to eq 3
149
+ expect(result.out_of_bounds?).to be_falsey
150
+ expect(result.first_page?).to be_falsey
151
+ expect(result.last_page?).to be_truthy
138
152
 
139
153
  p1 = Article.es.all(per_page: 7, page: 1)
140
- p1.out_of_bounds?.should be_false
141
- p1.first_page?.should be_true
142
- p1.last_page?.should be_false
143
- p1.current_page.should eq 1
144
- p1.next_page.should eq 2
154
+ expect(p1.out_of_bounds?).to be_falsey
155
+ expect(p1.first_page?).to be_truthy
156
+ expect(p1.last_page?).to be_falsey
157
+ expect(p1.current_page).to eq 1
158
+ expect(p1.next_page).to eq 2
145
159
 
146
160
  p3 = Article.es.all(per_page: 7, page: 3)
147
- p3.out_of_bounds?.should be_true
161
+ expect(p3.out_of_bounds?).to be_truthy
148
162
 
149
- p1.length.should eq 7
163
+ expect(p1.length).to eq 7
150
164
  all = (result.to_a + p1.to_a).map(&:id).map(&:to_s).sort
151
- all.length.should eq 10
152
- all.should eq @articles.map(&:id).map(&:to_s).sort
165
+ expect(all.length).to eq 10
166
+ expect(all).to eq @articles.map(&:id).map(&:to_s).sort
153
167
  end
154
168
  end
155
169
 
@@ -160,16 +174,16 @@ describe Article do
160
174
  Article.es.index.refresh
161
175
  end
162
176
  it '#destroy' do
163
- Article.es.all.count.should eq 10
177
+ expect(Article.es.all.count).to eq 10
164
178
  @articles[0].destroy
165
179
  Article.es.index.refresh
166
- Article.es.all.count.should eq 9
180
+ expect(Article.es.all.count).to eq 9
167
181
  end
168
182
  it '#destroy_all' do
169
- Article.es.all.count.should eq 10
183
+ expect(Article.es.all.count).to eq 10
170
184
  Article.destroy_all
171
185
  Article.es.index.refresh
172
- Article.es.all.count.should eq 0
186
+ expect(Article.es.all.count).to eq 0
173
187
  end
174
188
  end
175
189
  end
@@ -177,28 +191,28 @@ end
177
191
 
178
192
  describe Post do
179
193
  it 'properly uses options' do
180
- Post.es_index_name.should eq 'mongoid_es_test_posts'
181
- Post.es_wrapper.should eq :model
182
- Post.es_client_options.should eq(DEFAULT_OPT)
194
+ expect(Post.es_index_name).to eq 'mongoid_es_test_posts'
195
+ expect(Post.es_wrapper).to eq :model
196
+ expect(Post.es_client_options).to eq(DEFAULT_OPT)
183
197
  end
184
198
 
185
199
  context 'index operations' do
186
200
  it 'does not create index with empty definition (ES will do it for us)' do
187
- Post.es.index.exists?.should be_false
201
+ expect(Post.es.index.exists?).to be_falsey
188
202
  Post.es.index.create
189
- Post.es.index.exists?.should be_false
203
+ expect(Post.es.index.exists?).to be_falsey
190
204
  end
191
205
  it 'ES autocreates index on first index' do
192
- Post.es.index.exists?.should be_false
206
+ expect(Post.es.index.exists?).to be_falsey
193
207
  Post.create!(name: 'test post')
194
- Post.es.index.exists?.should be_true
208
+ expect(Post.es.index.exists?).to be_truthy
195
209
  end
196
210
  end
197
211
 
198
212
  context 'adding to index' do
199
213
  it 'successfuly saves mongoid document' do
200
214
  article = Post.new(name: 'test article name')
201
- article.save.should be_true
215
+ expect(article.save).to be_truthy
202
216
  end
203
217
  end
204
218
 
@@ -210,11 +224,11 @@ describe Post do
210
224
  end
211
225
 
212
226
  it 'searches and returns models' do
213
- Post.es.search('article').first.class.should eq Post
227
+ expect(Post.es.search('article').first.class).to eq Post
214
228
  sleep 1
215
- Post.es.search('article').count.should eq 2
216
- Post.es.search('another').count.should eq 1
217
- Post.es.search('another').first.id.should eq @post_2.id
229
+ expect(Post.es.search('article').count).to eq 2
230
+ expect(Post.es.search('another').count).to eq 1
231
+ expect(Post.es.search('another').first.id).to eq @post_2.id
218
232
  end
219
233
  end
220
234
 
@@ -225,21 +239,21 @@ describe Post do
225
239
  end
226
240
 
227
241
  it '#search' do
228
- Post.es.search('test').size.should eq 10
229
- Post.es.search('test', per_page: 7, page: 2).to_a.size.should eq 3
242
+ expect(Post.es.search('test').size).to eq 10
243
+ expect(Post.es.search('test', per_page: 7, page: 2).to_a.size).to eq 3
230
244
  end
231
245
 
232
246
  it '#all' do
233
- Post.es.all.size.should eq 10
234
- Post.es.all(per_page: 7, page: 2).to_a.size.should eq 3
247
+ expect(Post.es.all.size).to eq 10
248
+ expect(Post.es.all(per_page: 7, page: 2).to_a.size).to eq 3
235
249
  end
236
250
  end
237
251
  end
238
252
 
239
253
  describe Nowrapper do
240
254
  it 'properly uses options' do
241
- Nowrapper.es_index_name.should eq 'mongoid_es_test_nowrappers'
242
- Nowrapper.es_wrapper.should eq :none
255
+ expect(Nowrapper.es_index_name).to eq 'mongoid_es_test_nowrappers'
256
+ expect(Nowrapper.es_wrapper).to eq :none
243
257
  end
244
258
 
245
259
  context 'searching' do
@@ -251,10 +265,10 @@ describe Nowrapper do
251
265
 
252
266
  it 'searches and returns hashes' do
253
267
  # #count uses _count
254
- Nowrapper.es.search('article').count.should eq 2
268
+ expect(Nowrapper.es.search('article').count).to eq 2
255
269
  # #size and #length fetch results
256
- Nowrapper.es.search('article').length.should eq 2
257
- Nowrapper.es.search('article').first.class.should eq Hash
270
+ expect(Nowrapper.es.search('article').length).to eq 2
271
+ expect(Nowrapper.es.search('article').first.class).to eq Hash
258
272
  end
259
273
  end
260
274
  end
@@ -278,50 +292,50 @@ describe "Multisearch" do
278
292
  #pp response.results
279
293
  #pp response.raw_response
280
294
  #pp @article_1
281
- response.length.should eq 4
282
- response.to_a.map(&:class).map(&:name).uniq.sort.should eq ['Article', 'Namespaced::Model', 'Post']
283
- response.select { |r| r.class == Article && r.id == @article_1.id }.first.should_not be_nil
295
+ expect(response.length).to eq 4
296
+ expect(response.to_a.map(&:class).map(&:name).uniq.sort).to eq ['Article', 'Namespaced::Model', 'Post']
297
+ expect(response.select { |r| r.class == Article && r.id == @article_1.id }.first).not_to be_nil
284
298
  end
285
299
 
286
300
  it '#multi_with_load' do
287
301
  response = Mongoid::Elasticsearch.search 'test', wrapper: :load
288
- response.length.should eq 4
289
- response.to_a.map(&:class).map(&:name).uniq.sort.should eq ['Article', 'Namespaced::Model', 'Post']
290
- response.select { |r| r.class == Article && r.id == @article_1.id }.first.should_not be_nil
302
+ expect(response.length).to eq 4
303
+ expect(response.to_a.map(&:class).map(&:name).uniq.sort).to eq ['Article', 'Namespaced::Model', 'Post']
304
+ expect(response.select { |r| r.class == Article && r.id == @article_1.id }.first).not_to be_nil
291
305
  end
292
306
  end
293
307
 
294
308
  describe Namespaced::Model do
295
309
  it 'properly uses options' do
296
- Namespaced::Model.es_index_name.should eq 'mongoid_es_test_namespaced_models'
297
- Namespaced::Model.es.index.name.should eq 'mongoid_es_test_namespaced_models'
298
- Namespaced::Model.es.index.type.should eq 'namespaced/model'
299
- Namespaced::Model.es_wrapper.should eq :model
300
- Namespaced::Model.es_client_options.should eq(DEFAULT_OPT)
310
+ expect(Namespaced::Model.es_index_name).to eq 'mongoid_es_test_namespaced_models'
311
+ expect(Namespaced::Model.es.index.name).to eq 'mongoid_es_test_namespaced_models'
312
+ expect(Namespaced::Model.es.index.type).to eq 'namespaced/model'
313
+ expect(Namespaced::Model.es_wrapper).to eq :model
314
+ expect(Namespaced::Model.es_client_options).to eq(DEFAULT_OPT)
301
315
  end
302
316
 
303
317
  context 'index operations' do
304
318
  it 'creates and destroys index' do
305
- Namespaced::Model.es.index.exists?.should be_true
319
+ expect(Namespaced::Model.es.index.exists?).to be_truthy
306
320
  Namespaced::Model.es.index.delete
307
- Namespaced::Model.es.index.exists?.should be_false
321
+ expect(Namespaced::Model.es.index.exists?).to be_falsey
308
322
  Namespaced::Model.es.index.create
309
- Namespaced::Model.es.index.exists?.should be_true
323
+ expect(Namespaced::Model.es.index.exists?).to be_truthy
310
324
  end
311
325
  end
312
326
 
313
327
  context 'adding to index' do
314
328
  it 'successfuly saves mongoid document' do
315
329
  article = Namespaced::Model.new(name: 'test article name')
316
- article.save.should be_true
330
+ expect(article.save).to be_truthy
317
331
  end
318
332
  it 'successfuly destroys mongoid document' do
319
333
  article = Namespaced::Model.create(name: 'test article name')
320
334
  Namespaced::Model.es.index.refresh
321
- Namespaced::Model.es.all.count.should eq 1
335
+ expect(Namespaced::Model.es.all.count).to eq 1
322
336
  article.destroy
323
337
  Namespaced::Model.es.index.refresh
324
- Namespaced::Model.es.all.count.should eq 0
338
+ expect(Namespaced::Model.es.all.count).to eq 0
325
339
  end
326
340
  end
327
341
 
@@ -335,10 +349,10 @@ describe Namespaced::Model do
335
349
 
336
350
  it 'searches and returns models' do
337
351
  results = Namespaced::Model.es.search q: 'likely'
338
- results.count.should eq 1
339
- results.to_a.count.should eq 1
340
- results.first.id.should eq @article_2.id
341
- results.first.name.should eq @article_2.name
352
+ expect(results.count).to eq 1
353
+ expect(results.to_a.count).to eq 1
354
+ expect(results.first.id).to eq @article_2.id
355
+ expect(results.first.name).to eq @article_2.name
342
356
  end
343
357
  end
344
358
 
@@ -353,60 +367,60 @@ describe Namespaced::Model do
353
367
  end
354
368
 
355
369
  it '#search ignores irrelevant' do
356
- Namespaced::Model.es.search('irrelevant').to_a.size.should eq 1
357
- Namespaced::Model.es.search('test', per_page: 30).to_a.size.should eq 20
370
+ expect(Namespaced::Model.es.search('irrelevant').to_a.size).to eq 1
371
+ expect(Namespaced::Model.es.search('test', per_page: 30).to_a.size).to eq 20
358
372
  end
359
373
 
360
374
  it '#search dynamic wrapper' do
361
- Namespaced::Model.es.search('test', wrapper: :hash).map(&:class).map(&:name).uniq.should eq ['Hash']
362
- Namespaced::Model.es.search('test', wrapper: :mash).map(&:class).map(&:name).uniq.should eq ['Hashie::Mash']
363
- Namespaced::Model.es.search('test', wrapper: :mash).first.name.should eq 'test'
375
+ expect(Namespaced::Model.es.search('test', wrapper: :hash).map(&:class).map(&:name).uniq).to eq ['Hash']
376
+ expect(Namespaced::Model.es.search('test', wrapper: :mash).map(&:class).map(&:name).uniq).to eq ['Hashie::Mash']
377
+ expect(Namespaced::Model.es.search('test', wrapper: :mash).first.name).to eq 'test'
364
378
  end
365
379
 
366
380
  it '#search' do
367
- Namespaced::Model.es.search('test', per_page: 10, page: 2).to_a.size.should eq 10
368
- Namespaced::Model.es.search('test', per_page: 30, page: 2).to_a.size.should eq 0
369
- Namespaced::Model.es.search('test', per_page: 2, page: 2).to_a.size.should eq 2
370
- Namespaced::Model.es.search(body: {query: {query_string: {query: 'test'}}}, size: 50).to_a.length.should eq 20
381
+ expect(Namespaced::Model.es.search('test', per_page: 10, page: 2).to_a.size).to eq 10
382
+ expect(Namespaced::Model.es.search('test', per_page: 30, page: 2).to_a.size).to eq 0
383
+ expect(Namespaced::Model.es.search('test', per_page: 2, page: 2).to_a.size).to eq 2
384
+ expect(Namespaced::Model.es.search(body: {query: {query_string: {query: 'test'}}}, size: 50).to_a.length).to eq 20
371
385
  end
372
386
 
373
387
  it 'bulk index' do
374
388
  Namespaced::Model.es.index.reset
375
389
  Namespaced::Model.es.index_all
376
390
  Namespaced::Model.es.index.refresh
377
- Namespaced::Model.es.search('test', per_page: 10, page: 2).to_a.size.should eq 10
378
- Namespaced::Model.es.search('test', per_page: 30, page: 2).to_a.size.should eq 0
379
- Namespaced::Model.es.search('test', per_page: 2, page: 2).to_a.size.should eq 2
380
- Namespaced::Model.es.search(body: {query: {query_string: {query: 'test'}}}, size: 50).to_a.length.should eq 20
391
+ expect(Namespaced::Model.es.search('test', per_page: 10, page: 2).to_a.size).to eq 10
392
+ expect(Namespaced::Model.es.search('test', per_page: 30, page: 2).to_a.size).to eq 0
393
+ expect(Namespaced::Model.es.search('test', per_page: 2, page: 2).to_a.size).to eq 2
394
+ expect(Namespaced::Model.es.search(body: {query: {query_string: {query: 'test'}}}, size: 50).to_a.length).to eq 20
381
395
  end
382
396
 
383
397
 
384
398
  it '#all' do
385
399
  result = Namespaced::Model.es.all(per_page: 7, page: 3)
386
- result.num_pages.should eq 4
387
- result.to_a.size.should eq 7
400
+ expect(result.num_pages).to eq 4
401
+ expect(result.to_a.size).to eq 7
388
402
  p1 = Namespaced::Model.es.all(per_page: 7, page: 1).to_a
389
403
  p2 = Namespaced::Model.es.all(per_page: 7, page: 2).to_a
390
404
  p4 = Namespaced::Model.es.all(per_page: 7, page: 4).to_a
391
- p1.length.should eq 7
392
- p2.length.should eq 7
393
- p4.length.should eq 1
405
+ expect(p1.length).to eq 7
406
+ expect(p2.length).to eq 7
407
+ expect(p4.length).to eq 1
394
408
  all = (p1 + p2 + result.to_a + p4).map(&:id).map(&:to_s).sort
395
- all.length.should eq 22
396
- all.should eq (@articles + [@a1, @a2]).map(&:id).map(&:to_s).sort
409
+ expect(all.length).to eq 22
410
+ expect(all).to eq (@articles + [@a1, @a2]).map(&:id).map(&:to_s).sort
397
411
  end
398
412
  end
399
413
  end
400
414
 
401
415
  describe 'utils' do
402
416
  it 'doesnt strip non-ascii text' do
403
- Mongoid::Elasticsearch::Utils.clean('тест {{').should eq 'тест'
417
+ expect(Mongoid::Elasticsearch::Utils.clean('тест {{')).to eq 'тест'
404
418
  end
405
419
  it 'doesnt strip good white space' do
406
- Mongoid::Elasticsearch::Utils.clean('test test').should eq 'test test'
420
+ expect(Mongoid::Elasticsearch::Utils.clean('test test')).to eq 'test test'
407
421
  end
408
422
  it 'strip extra white space' do
409
- Mongoid::Elasticsearch::Utils.clean(' test test ').should eq 'test test'
423
+ expect(Mongoid::Elasticsearch::Utils.clean(' test test ')).to eq 'test test'
410
424
  end
411
425
  end
412
426
 
@@ -414,13 +428,13 @@ end
414
428
  describe 'no autocreate' do
415
429
  it "desn't create index automatically" do
416
430
  NoAutocreate.es.index.delete
417
- NoAutocreate.es.index.exists?.should be_false
431
+ expect(NoAutocreate.es.index.exists?).to be_falsey
418
432
 
419
433
  Mongoid::Elasticsearch.create_all_indexes!
420
- NoAutocreate.es.index.exists?.should be_false
434
+ expect(NoAutocreate.es.index.exists?).to be_falsey
421
435
 
422
436
  NoAutocreate.es.index.force_create
423
- NoAutocreate.es.index.exists?.should be_true
437
+ expect(NoAutocreate.es.index.exists?).to be_truthy
424
438
 
425
439
  NoAutocreate.es.index.delete
426
440
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid