sunspot 2.2.7 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -0
  4. data/Appraisals +7 -0
  5. data/Gemfile +0 -8
  6. data/lib/sunspot/adapters.rb +4 -1
  7. data/lib/sunspot/configuration.rb +1 -0
  8. data/lib/sunspot/data_extractor.rb +36 -6
  9. data/lib/sunspot/dsl/field_query.rb +11 -0
  10. data/lib/sunspot/dsl/field_stats.rb +7 -0
  11. data/lib/sunspot/dsl/fields.rb +16 -0
  12. data/lib/sunspot/dsl/group.rb +10 -0
  13. data/lib/sunspot/dsl/scope.rb +23 -18
  14. data/lib/sunspot/field.rb +11 -0
  15. data/lib/sunspot/field_factory.rb +6 -2
  16. data/lib/sunspot/query/abstract_json_field_facet.rb +70 -0
  17. data/lib/sunspot/query/bbox.rb +5 -1
  18. data/lib/sunspot/query/date_field_json_facet.rb +25 -0
  19. data/lib/sunspot/query/field_json_facet.rb +19 -0
  20. data/lib/sunspot/query/field_stats.rb +35 -2
  21. data/lib/sunspot/query/group.rb +4 -5
  22. data/lib/sunspot/query/join.rb +2 -4
  23. data/lib/sunspot/query/range_json_facet.rb +28 -0
  24. data/lib/sunspot/query/restriction.rb +19 -4
  25. data/lib/sunspot/query.rb +3 -3
  26. data/lib/sunspot/schema.rb +10 -2
  27. data/lib/sunspot/search/abstract_search.rb +14 -1
  28. data/lib/sunspot/search/field_json_facet.rb +33 -0
  29. data/lib/sunspot/search/hit.rb +6 -1
  30. data/lib/sunspot/search/hit_enumerable.rb +4 -1
  31. data/lib/sunspot/search/json_facet_row.rb +40 -0
  32. data/lib/sunspot/search/json_facet_stats.rb +23 -0
  33. data/lib/sunspot/search/standard_search.rb +2 -3
  34. data/lib/sunspot/search/stats_json_row.rb +82 -0
  35. data/lib/sunspot/search/stats_row.rb +3 -1
  36. data/lib/sunspot/search.rb +4 -3
  37. data/lib/sunspot/session.rb +13 -5
  38. data/lib/sunspot/setup.rb +31 -0
  39. data/lib/sunspot/util.rb +23 -0
  40. data/lib/sunspot/version.rb +1 -1
  41. data/spec/api/adapters_spec.rb +32 -19
  42. data/spec/api/batcher_spec.rb +15 -15
  43. data/spec/api/binding_spec.rb +3 -3
  44. data/spec/api/class_set_spec.rb +3 -3
  45. data/spec/api/data_extractor_spec.rb +39 -0
  46. data/spec/api/hit_enumerable_spec.rb +32 -9
  47. data/spec/api/indexer/attributes_spec.rb +31 -31
  48. data/spec/api/indexer/batch_spec.rb +8 -7
  49. data/spec/api/indexer/dynamic_fields_spec.rb +8 -8
  50. data/spec/api/indexer/fixed_fields_spec.rb +12 -12
  51. data/spec/api/indexer/fulltext_spec.rb +8 -8
  52. data/spec/api/indexer/removal_spec.rb +14 -14
  53. data/spec/api/indexer_spec.rb +2 -2
  54. data/spec/api/query/advanced_manipulation_examples.rb +3 -3
  55. data/spec/api/query/connectives_examples.rb +26 -14
  56. data/spec/api/query/dsl_spec.rb +17 -9
  57. data/spec/api/query/dynamic_fields_examples.rb +18 -18
  58. data/spec/api/query/faceting_examples.rb +62 -62
  59. data/spec/api/query/fulltext_examples.rb +63 -58
  60. data/spec/api/query/function_spec.rb +26 -26
  61. data/spec/api/query/geo_examples.rb +6 -6
  62. data/spec/api/query/group_spec.rb +6 -6
  63. data/spec/api/query/highlighting_examples.rb +26 -26
  64. data/spec/api/query/join_spec.rb +2 -2
  65. data/spec/api/query/more_like_this_spec.rb +29 -29
  66. data/spec/api/query/ordering_pagination_examples.rb +25 -25
  67. data/spec/api/query/scope_examples.rb +39 -39
  68. data/spec/api/query/spatial_examples.rb +3 -3
  69. data/spec/api/query/spellcheck_examples.rb +3 -3
  70. data/spec/api/query/standard_spec.rb +1 -1
  71. data/spec/api/query/stats_examples.rb +8 -8
  72. data/spec/api/query/text_field_scoping_examples.rb +5 -5
  73. data/spec/api/query/types_spec.rb +4 -4
  74. data/spec/api/search/cursor_paginated_collection_spec.rb +12 -12
  75. data/spec/api/search/dynamic_fields_spec.rb +4 -4
  76. data/spec/api/search/faceting_spec.rb +55 -52
  77. data/spec/api/search/highlighting_spec.rb +7 -7
  78. data/spec/api/search/hits_spec.rb +43 -29
  79. data/spec/api/search/paginated_collection_spec.rb +18 -18
  80. data/spec/api/search/results_spec.rb +13 -13
  81. data/spec/api/search/search_spec.rb +3 -3
  82. data/spec/api/search/stats_spec.rb +10 -10
  83. data/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +19 -18
  84. data/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +9 -9
  85. data/spec/api/session_proxy/master_slave_session_proxy_spec.rb +10 -6
  86. data/spec/api/session_proxy/retry_5xx_session_proxy_spec.rb +10 -10
  87. data/spec/api/session_proxy/sharding_session_proxy_spec.rb +14 -13
  88. data/spec/api/session_proxy/silent_fail_session_proxy_spec.rb +2 -2
  89. data/spec/api/session_proxy/spec_helper.rb +1 -1
  90. data/spec/api/session_proxy/thread_local_session_proxy_spec.rb +9 -5
  91. data/spec/api/session_spec.rb +42 -42
  92. data/spec/api/sunspot_spec.rb +7 -4
  93. data/spec/helpers/integration_helper.rb +1 -0
  94. data/spec/integration/atomic_updates_spec.rb +25 -11
  95. data/spec/integration/dynamic_fields_spec.rb +10 -10
  96. data/spec/integration/faceting_spec.rb +252 -39
  97. data/spec/integration/field_grouping_spec.rb +35 -16
  98. data/spec/integration/field_lists_spec.rb +57 -0
  99. data/spec/integration/geospatial_spec.rb +34 -8
  100. data/spec/integration/highlighting_spec.rb +5 -5
  101. data/spec/integration/indexing_spec.rb +5 -5
  102. data/spec/integration/join_spec.rb +45 -0
  103. data/spec/integration/keyword_search_spec.rb +47 -45
  104. data/spec/integration/local_search_spec.rb +4 -4
  105. data/spec/integration/more_like_this_spec.rb +7 -7
  106. data/spec/integration/scoped_search_spec.rb +108 -108
  107. data/spec/integration/spellcheck_spec.rb +52 -7
  108. data/spec/integration/stats_spec.rb +54 -13
  109. data/spec/integration/stored_fields_spec.rb +1 -1
  110. data/spec/integration/test_pagination.rb +4 -4
  111. data/spec/integration/unicode_spec.rb +1 -1
  112. data/spec/mocks/adapters.rb +33 -0
  113. data/spec/mocks/photo.rb +14 -4
  114. data/spec/mocks/post.rb +9 -1
  115. data/spec/spec_helper.rb +11 -10
  116. data/sunspot.gemspec +3 -1
  117. metadata +49 -6
@@ -7,7 +7,7 @@ shared_examples_for 'all sessions' do
7
7
  end
8
8
 
9
9
  it 'should add document to connection' do
10
- connection.should have(1).adds
10
+ expect(connection.adds.size).to eq(1)
11
11
  end
12
12
  end
13
13
 
@@ -17,11 +17,11 @@ shared_examples_for 'all sessions' do
17
17
  end
18
18
 
19
19
  it 'should add document to connection' do
20
- connection.should have(1).adds
20
+ expect(connection.adds.size).to eq(1)
21
21
  end
22
22
 
23
23
  it 'should commit' do
24
- connection.should have(1).commits
24
+ expect(connection.commits.size).to eq(1)
25
25
  end
26
26
  end
27
27
 
@@ -31,27 +31,27 @@ shared_examples_for 'all sessions' do
31
31
  end
32
32
 
33
33
  it 'should commit' do
34
- connection.should have(1).commits
34
+ expect(connection.commits.size).to eq(1)
35
35
  end
36
36
  end
37
37
 
38
38
  context '#commit(bool)' do
39
39
  it 'should soft-commit if bool=true' do
40
40
  @session.commit(true)
41
- connection.should have(1).commits
42
- connection.should have(1).soft_commits
41
+ expect(connection.commits.size).to eq(1)
42
+ expect(connection.soft_commits.size).to eq(1)
43
43
  end
44
44
 
45
45
  it 'should hard-commit if bool=false' do
46
46
  @session.commit(false)
47
- connection.should have(1).commits
48
- connection.should have(0).soft_commits
47
+ expect(connection.commits.size).to eq(1)
48
+ expect(connection.soft_commits.size).to eq(0)
49
49
  end
50
50
 
51
51
  it 'should hard-commit if bool is not specified' do
52
52
  @session.commit
53
- connection.should have(1).commits
54
- connection.should have(0).soft_commits
53
+ expect(connection.commits.size).to eq(1)
54
+ expect(connection.soft_commits.size).to eq(0)
55
55
  end
56
56
  end
57
57
 
@@ -61,7 +61,7 @@ shared_examples_for 'all sessions' do
61
61
  end
62
62
 
63
63
  it 'should optimize' do
64
- connection.should have(1).optims
64
+ expect(connection.optims.size).to eq(1)
65
65
  end
66
66
  end
67
67
 
@@ -71,7 +71,7 @@ shared_examples_for 'all sessions' do
71
71
  end
72
72
 
73
73
  it 'should search' do
74
- connection.should have(1).searches
74
+ expect(connection.searches.size).to eq(1)
75
75
  end
76
76
  end
77
77
  end
@@ -97,31 +97,31 @@ describe 'Session' do
97
97
 
98
98
  it 'should open connection with defaults if nothing specified' do
99
99
  Sunspot.commit
100
- connection.opts[:url].should == 'http://127.0.0.1:8983/solr/default'
100
+ expect(connection.opts[:url]).to eq('http://127.0.0.1:8983/solr/default')
101
101
  end
102
102
 
103
103
  it 'should open a connection with custom host' do
104
104
  Sunspot.config.solr.url = 'http://127.0.0.1:8981/solr'
105
105
  Sunspot.commit
106
- connection.opts[:url].should == 'http://127.0.0.1:8981/solr'
106
+ expect(connection.opts[:url]).to eq('http://127.0.0.1:8981/solr')
107
107
  end
108
108
 
109
109
  it 'should open a connection with custom read timeout' do
110
110
  Sunspot.config.solr.read_timeout = 0.5
111
111
  Sunspot.commit
112
- connection.opts[:read_timeout].should == 0.5
112
+ expect(connection.opts[:read_timeout]).to eq(0.5)
113
113
  end
114
114
 
115
115
  it 'should open a connection with custom open timeout' do
116
116
  Sunspot.config.solr.open_timeout = 0.5
117
117
  Sunspot.commit
118
- connection.opts[:open_timeout].should == 0.5
118
+ expect(connection.opts[:open_timeout]).to eq(0.5)
119
119
  end
120
120
 
121
121
  it 'should open a connection through a provided proxy' do
122
122
  Sunspot.config.solr.proxy = 'http://proxy.com:1234'
123
123
  Sunspot.commit
124
- connection.opts[:proxy].should == 'http://proxy.com:1234'
124
+ expect(connection.opts[:proxy]).to eq('http://proxy.com:1234')
125
125
  end
126
126
  end
127
127
 
@@ -137,7 +137,7 @@ describe 'Session' do
137
137
  config.solr.url = 'http://127.0.0.1:8982/solr'
138
138
  end
139
139
  session.commit
140
- connection.opts[:url].should == 'http://127.0.0.1:8982/solr'
140
+ expect(connection.opts[:url]).to eq('http://127.0.0.1:8982/solr')
141
141
  end
142
142
  end
143
143
 
@@ -147,120 +147,120 @@ describe 'Session' do
147
147
  end
148
148
 
149
149
  it 'should start out not dirty' do
150
- @session.dirty?.should be_false
150
+ expect(@session.dirty?).to be(false)
151
151
  end
152
152
 
153
153
  it 'should start out not delete_dirty' do
154
- @session.delete_dirty?.should be_false
154
+ expect(@session.delete_dirty?).to be(false)
155
155
  end
156
156
 
157
157
  it 'should be dirty after adding an item' do
158
158
  @session.index(Post.new)
159
- @session.dirty?.should be_true
159
+ expect(@session.dirty?).to be(true)
160
160
  end
161
161
 
162
162
  it 'should be not be delete_dirty after adding an item' do
163
163
  @session.index(Post.new)
164
- @session.delete_dirty?.should be_false
164
+ expect(@session.delete_dirty?).to be(false)
165
165
  end
166
166
 
167
167
  it 'should be dirty after deleting an item' do
168
168
  @session.remove(Post.new)
169
- @session.dirty?.should be_true
169
+ expect(@session.dirty?).to be(true)
170
170
  end
171
171
 
172
172
  it 'should be delete_dirty after deleting an item' do
173
173
  @session.remove(Post.new)
174
- @session.delete_dirty?.should be_true
174
+ expect(@session.delete_dirty?).to be(true)
175
175
  end
176
176
 
177
177
  it 'should be dirty after a remove_all for a class' do
178
178
  @session.remove_all(Post)
179
- @session.dirty?.should be_true
179
+ expect(@session.dirty?).to be(true)
180
180
  end
181
181
 
182
182
  it 'should be delete_dirty after a remove_all for a class' do
183
183
  @session.remove_all(Post)
184
- @session.delete_dirty?.should be_true
184
+ expect(@session.delete_dirty?).to be(true)
185
185
  end
186
186
 
187
187
  it 'should be dirty after a global remove_all' do
188
188
  @session.remove_all
189
- @session.dirty?.should be_true
189
+ expect(@session.dirty?).to be(true)
190
190
  end
191
191
 
192
192
  it 'should be delete_dirty after a global remove_all' do
193
193
  @session.remove_all
194
- @session.delete_dirty?.should be_true
194
+ expect(@session.delete_dirty?).to be(true)
195
195
  end
196
196
 
197
197
  it 'should not be dirty after a commit' do
198
198
  @session.index(Post.new)
199
199
  @session.commit
200
- @session.dirty?.should be_false
200
+ expect(@session.dirty?).to be(false)
201
201
  end
202
202
 
203
203
  it 'should not be dirty after an optimize' do
204
204
  @session.index(Post.new)
205
205
  @session.optimize
206
- @session.dirty?.should be_false
206
+ expect(@session.dirty?).to be(false)
207
207
  end
208
208
 
209
209
  it 'should not be delete_dirty after a commit' do
210
210
  @session.remove(Post.new)
211
211
  @session.commit
212
- @session.delete_dirty?.should be_false
212
+ expect(@session.delete_dirty?).to be(false)
213
213
  end
214
214
 
215
215
  it 'should not be delete_dirty after an optimize' do
216
216
  @session.remove(Post.new)
217
217
  @session.optimize
218
- @session.delete_dirty?.should be_false
218
+ expect(@session.delete_dirty?).to be(false)
219
219
  end
220
220
 
221
221
  it 'should not commit when commit_if_dirty called on clean session' do
222
222
  @session.commit_if_dirty
223
- connection.should have(0).commits
223
+ expect(connection.commits.size).to eq(0)
224
224
  end
225
225
 
226
226
  it 'should not commit when commit_if_delete_dirty called on clean session' do
227
227
  @session.commit_if_delete_dirty
228
- connection.should have(0).commits
228
+ expect(connection.commits.size).to eq(0)
229
229
  end
230
230
 
231
231
  it 'should hard commit when commit_if_dirty called on dirty session' do
232
232
  @session.index(Post.new)
233
233
  @session.commit_if_dirty
234
- connection.should have(1).commits
234
+ expect(connection.commits.size).to eq(1)
235
235
  end
236
236
 
237
237
  it 'should soft commit when commit_if_dirty called on dirty session' do
238
238
  @session.index(Post.new)
239
239
  @session.commit_if_dirty(true)
240
- connection.should have(1).commits
241
- connection.should have(1).soft_commits
240
+ expect(connection.commits.size).to eq(1)
241
+ expect(connection.soft_commits.size).to eq(1)
242
242
  end
243
243
 
244
244
  it 'should hard commit when commit_if_delete_dirty called on delete_dirty session' do
245
245
  @session.remove(Post.new)
246
246
  @session.commit_if_delete_dirty
247
- connection.should have(1).commits
247
+ expect(connection.commits.size).to eq(1)
248
248
  end
249
249
 
250
250
  it 'should soft commit when commit_if_delete_dirty called on delete_dirty session' do
251
251
  @session.remove(Post.new)
252
252
  @session.commit_if_delete_dirty(true)
253
- connection.should have(1).commits
254
- connection.should have(1).soft_commits
253
+ expect(connection.commits.size).to eq(1)
254
+ expect(connection.soft_commits.size).to eq(1)
255
255
  end
256
256
  end
257
257
 
258
258
  context 'session proxy' do
259
259
  it 'should send messages to manually assigned session proxy' do
260
- stub_session = stub('session')
260
+ stub_session = double('session')
261
261
  Sunspot.session = stub_session
262
262
  post = Post.new
263
- stub_session.should_receive(:index).with(post)
263
+ expect(stub_session).to receive(:index).with(post)
264
264
  Sunspot.index(post)
265
265
  Sunspot.reset!
266
266
  end
@@ -7,8 +7,8 @@ describe Sunspot do
7
7
  Sunspot.setup(User) do
8
8
  text :name
9
9
  end
10
- Sunspot.searchable.should_not be_empty
11
- Sunspot.searchable.should include(User)
10
+ expect(Sunspot.searchable).not_to be_empty
11
+ expect(Sunspot.searchable).to include(User)
12
12
  end
13
13
  end
14
14
 
@@ -16,14 +16,17 @@ describe Sunspot do
16
16
  it "should reset current session" do
17
17
  old_session = Sunspot.send(:session)
18
18
  Sunspot.reset!(true)
19
- Sunspot.send(:session).should_not == old_session
19
+ expect(Sunspot.send(:session)).not_to eq(old_session)
20
20
  end
21
21
 
22
22
  it "should keep keep configuration if specified" do
23
23
  Sunspot.config.solr.url = "http://localhost:9999/path/solr"
24
24
  config_before_reset = Sunspot.config
25
25
  Sunspot.reset!(true)
26
- Sunspot.config.should == config_before_reset
26
+ expect(Sunspot.config).to eq(config_before_reset)
27
+
28
+ # Restore sunspot config after test
29
+ Sunspot.reset!(false)
27
30
  end
28
31
  end
29
32
  end
@@ -2,6 +2,7 @@ module IntegrationHelper
2
2
  def self.included(base)
3
3
  base.before(:all) do
4
4
  Sunspot.config.solr.url = ENV['SOLR_URL'] || 'http://localhost:8983/solr/default'
5
+ Sunspot.config.solr.update_format = ENV['UPDATE_FORMAT'].to_sym if ENV['UPDATE_FORMAT']
5
6
  Sunspot.reset!(true)
6
7
  end
7
8
  end
@@ -5,14 +5,16 @@ describe 'atomic updates' do
5
5
  Sunspot.remove_all
6
6
  end
7
7
 
8
- def validate_hit(hit, title, featured)
9
- hit.stored(:title).should == title
10
- hit.stored(:featured).should == featured
8
+ def validate_hit(hit, values = {})
9
+ values.each do |field, value|
10
+ stored = hit.stored(field)
11
+ expect(stored).to eq(value), "expected #{value.inspect}, but got #{stored.inspect} for field '#{field}'"
12
+ end
11
13
  end
12
14
 
13
15
  def find_indexed_post(id)
14
16
  hit = Sunspot.search(Post).hits.find{ |h| h.primary_key.to_i == id }
15
- hit.should_not be_nil
17
+ expect(hit).not_to be_nil
16
18
  hit
17
19
  end
18
20
 
@@ -20,13 +22,13 @@ describe 'atomic updates' do
20
22
  post = Post.new(title: 'A Title', featured: true)
21
23
  Sunspot.index!(post)
22
24
 
23
- validate_hit(find_indexed_post(post.id), post.title, post.featured)
25
+ validate_hit(find_indexed_post(post.id), title: post.title, featured: post.featured)
24
26
 
25
27
  Sunspot.atomic_update!(Post, post.id => {title: 'A New Title'})
26
- validate_hit(find_indexed_post(post.id), 'A New Title', true)
28
+ validate_hit(find_indexed_post(post.id), title: 'A New Title', featured: true)
27
29
 
28
30
  Sunspot.atomic_update!(Post, post.id => {featured: false})
29
- validate_hit(find_indexed_post(post.id), 'A New Title', false)
31
+ validate_hit(find_indexed_post(post.id), title: 'A New Title', featured: false)
30
32
  end
31
33
 
32
34
  it 'should update fields for multiple records' do
@@ -34,11 +36,23 @@ describe 'atomic updates' do
34
36
  post2 = Post.new(title: 'A Second Title', featured: false)
35
37
  Sunspot.index!(post1, post2)
36
38
 
37
- validate_hit(find_indexed_post(post1.id), post1.title, post1.featured)
38
- validate_hit(find_indexed_post(post2.id), post2.title, post2.featured)
39
+ validate_hit(find_indexed_post(post1.id), title: post1.title, featured: post1.featured)
40
+ validate_hit(find_indexed_post(post2.id), title: post2.title, featured: post2.featured)
39
41
 
40
42
  Sunspot.atomic_update!(Post, post1.id => {title: 'A New Title'}, post2.id => {featured: true})
41
- validate_hit(find_indexed_post(post1.id), 'A New Title', true)
42
- validate_hit(find_indexed_post(post2.id), 'A Second Title', true)
43
+ validate_hit(find_indexed_post(post1.id), title: 'A New Title', featured: true)
44
+ validate_hit(find_indexed_post(post2.id), title: 'A Second Title', featured: true)
45
+ end
46
+
47
+ it 'should clear field value properly' do
48
+ post = Post.new(title: 'A Title', tags: %w(tag1 tag2), featured: true)
49
+ Sunspot.index!(post)
50
+ validate_hit(find_indexed_post(post.id), title: post.title, tag_list: post.tags, featured: true)
51
+
52
+ Sunspot.atomic_update!(Post, post.id => {tag_list: []})
53
+ validate_hit(find_indexed_post(post.id), title: post.title, tag_list: nil, featured: true)
54
+
55
+ Sunspot.atomic_update!(Post, post.id => {featured: nil})
56
+ validate_hit(find_indexed_post(post.id), title: post.title, tag_list: nil, featured: nil)
43
57
  end
44
58
  end
@@ -10,11 +10,11 @@ shared_examples 'dynamic fields' do
10
10
  end
11
11
 
12
12
  it 'should search for dynamic string field' do
13
- Sunspot.search(Post) do
13
+ expect(Sunspot.search(Post) do
14
14
  dynamic(field_name) do
15
15
  with(:cuisine, 'Pizza')
16
16
  end
17
- end.results.should == [@posts.first]
17
+ end.results).to eq([@posts.first])
18
18
  end
19
19
 
20
20
  describe 'faceting' do
@@ -28,31 +28,31 @@ shared_examples 'dynamic fields' do
28
28
 
29
29
  it 'should return value "value" with count 2' do
30
30
  row = @search.dynamic_facet(field_name, :cuisine).rows[0]
31
- row.value.should == 'Greek'
32
- row.count.should == 2
31
+ expect(row.value).to eq('Greek')
32
+ expect(row.count).to eq(2)
33
33
  end
34
34
 
35
35
  it 'should return value "other" with count 1' do
36
36
  row = @search.dynamic_facet(field_name, :cuisine).rows[1]
37
- row.value.should == 'Pizza'
38
- row.count.should == 1
37
+ expect(row.value).to eq('Pizza')
38
+ expect(row.count).to eq(1)
39
39
  end
40
40
  end
41
41
 
42
42
  it 'should order by dynamic string field ascending' do
43
- Sunspot.search(Post) do
43
+ expect(Sunspot.search(Post) do
44
44
  dynamic field_name do
45
45
  order_by :cuisine, :asc
46
46
  end
47
- end.results.last.should == @posts.first
47
+ end.results.last).to eq(@posts.first)
48
48
  end
49
49
 
50
50
  it 'should order by dynamic string field descending' do
51
- Sunspot.search(Post) do
51
+ expect(Sunspot.search(Post) do
52
52
  dynamic field_name do
53
53
  order_by :cuisine, :desc
54
54
  end
55
- end.results.first.should == @posts.first
55
+ end.results.first).to eq(@posts.first)
56
56
  end
57
57
  end
58
58