sunspot 2.2.7 → 2.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -0
  4. data/Appraisals +7 -0
  5. data/Gemfile +0 -8
  6. data/gemfiles/.gitkeep +0 -0
  7. data/lib/sunspot/dsl/scope.rb +6 -1
  8. data/lib/sunspot/field.rb +11 -0
  9. data/lib/sunspot/field_factory.rb +6 -2
  10. data/lib/sunspot/query/bbox.rb +5 -1
  11. data/lib/sunspot/query/restriction.rb +11 -0
  12. data/lib/sunspot/search/hit_enumerable.rb +4 -1
  13. data/lib/sunspot/search/standard_search.rb +2 -3
  14. data/lib/sunspot/version.rb +1 -1
  15. data/spec/api/adapters_spec.rb +19 -19
  16. data/spec/api/batcher_spec.rb +15 -15
  17. data/spec/api/binding_spec.rb +3 -3
  18. data/spec/api/class_set_spec.rb +3 -3
  19. data/spec/api/hit_enumerable_spec.rb +32 -9
  20. data/spec/api/indexer/attributes_spec.rb +31 -31
  21. data/spec/api/indexer/batch_spec.rb +8 -7
  22. data/spec/api/indexer/dynamic_fields_spec.rb +8 -8
  23. data/spec/api/indexer/fixed_fields_spec.rb +12 -12
  24. data/spec/api/indexer/fulltext_spec.rb +8 -8
  25. data/spec/api/indexer/removal_spec.rb +14 -14
  26. data/spec/api/indexer_spec.rb +2 -2
  27. data/spec/api/query/advanced_manipulation_examples.rb +3 -3
  28. data/spec/api/query/connectives_examples.rb +26 -14
  29. data/spec/api/query/dsl_spec.rb +17 -9
  30. data/spec/api/query/dynamic_fields_examples.rb +18 -18
  31. data/spec/api/query/faceting_examples.rb +62 -62
  32. data/spec/api/query/fulltext_examples.rb +56 -55
  33. data/spec/api/query/function_spec.rb +26 -26
  34. data/spec/api/query/geo_examples.rb +6 -6
  35. data/spec/api/query/group_spec.rb +6 -6
  36. data/spec/api/query/highlighting_examples.rb +26 -26
  37. data/spec/api/query/join_spec.rb +2 -2
  38. data/spec/api/query/more_like_this_spec.rb +29 -29
  39. data/spec/api/query/ordering_pagination_examples.rb +25 -25
  40. data/spec/api/query/scope_examples.rb +39 -39
  41. data/spec/api/query/spatial_examples.rb +3 -3
  42. data/spec/api/query/spellcheck_examples.rb +3 -3
  43. data/spec/api/query/standard_spec.rb +1 -1
  44. data/spec/api/query/stats_examples.rb +8 -8
  45. data/spec/api/query/text_field_scoping_examples.rb +5 -5
  46. data/spec/api/query/types_spec.rb +4 -4
  47. data/spec/api/search/cursor_paginated_collection_spec.rb +12 -12
  48. data/spec/api/search/dynamic_fields_spec.rb +4 -4
  49. data/spec/api/search/faceting_spec.rb +55 -52
  50. data/spec/api/search/highlighting_spec.rb +7 -7
  51. data/spec/api/search/hits_spec.rb +29 -29
  52. data/spec/api/search/paginated_collection_spec.rb +18 -18
  53. data/spec/api/search/results_spec.rb +13 -13
  54. data/spec/api/search/search_spec.rb +3 -3
  55. data/spec/api/search/stats_spec.rb +10 -10
  56. data/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +19 -18
  57. data/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +9 -9
  58. data/spec/api/session_proxy/master_slave_session_proxy_spec.rb +10 -6
  59. data/spec/api/session_proxy/retry_5xx_session_proxy_spec.rb +10 -10
  60. data/spec/api/session_proxy/sharding_session_proxy_spec.rb +14 -13
  61. data/spec/api/session_proxy/silent_fail_session_proxy_spec.rb +2 -2
  62. data/spec/api/session_proxy/spec_helper.rb +1 -1
  63. data/spec/api/session_proxy/thread_local_session_proxy_spec.rb +9 -5
  64. data/spec/api/session_spec.rb +42 -42
  65. data/spec/api/sunspot_spec.rb +4 -4
  66. data/spec/integration/atomic_updates_spec.rb +25 -11
  67. data/spec/integration/dynamic_fields_spec.rb +10 -10
  68. data/spec/integration/faceting_spec.rb +39 -39
  69. data/spec/integration/field_grouping_spec.rb +16 -16
  70. data/spec/integration/field_lists_spec.rb +41 -0
  71. data/spec/integration/geospatial_spec.rb +19 -8
  72. data/spec/integration/highlighting_spec.rb +5 -5
  73. data/spec/integration/indexing_spec.rb +5 -5
  74. data/spec/integration/keyword_search_spec.rb +47 -45
  75. data/spec/integration/local_search_spec.rb +4 -4
  76. data/spec/integration/more_like_this_spec.rb +7 -7
  77. data/spec/integration/scoped_search_spec.rb +107 -107
  78. data/spec/integration/spellcheck_spec.rb +52 -7
  79. data/spec/integration/stats_spec.rb +10 -10
  80. data/spec/integration/stored_fields_spec.rb +1 -1
  81. data/spec/integration/test_pagination.rb +4 -4
  82. data/spec/integration/unicode_spec.rb +1 -1
  83. data/spec/mocks/post.rb +5 -1
  84. data/spec/spec_helper.rb +11 -6
  85. data/sunspot.gemspec +3 -1
  86. metadata +40 -7
@@ -5,35 +5,35 @@ shared_examples_for 'geohash query' do
5
5
  search do
6
6
  with(:coordinates).near(40.7, -73.5)
7
7
  end
8
- connection.should have_last_search_including(:q, build_geo_query)
8
+ expect(connection).to have_last_search_including(:q, build_geo_query)
9
9
  end
10
10
 
11
11
  it 'searches for nearby points with non-Float arguments' do
12
12
  search do
13
13
  with(:coordinates).near(BigDecimal.new('40.7'), BigDecimal.new('-73.5'))
14
14
  end
15
- connection.should have_last_search_including(:q, build_geo_query)
15
+ expect(connection).to have_last_search_including(:q, build_geo_query)
16
16
  end
17
17
 
18
18
  it 'searches for nearby points with given precision' do
19
19
  search do
20
20
  with(:coordinates).near(40.7, -73.5, :precision => 10)
21
21
  end
22
- connection.should have_last_search_including(:q, build_geo_query(:precision => 10))
22
+ expect(connection).to have_last_search_including(:q, build_geo_query(:precision => 10))
23
23
  end
24
24
 
25
25
  it 'searches for nearby points with given precision factor' do
26
26
  search do
27
27
  with(:coordinates).near(40.7, -73.5, :precision_factor => 1.5)
28
28
  end
29
- connection.should have_last_search_including(:q, build_geo_query(:precision_factor => 1.5))
29
+ expect(connection).to have_last_search_including(:q, build_geo_query(:precision_factor => 1.5))
30
30
  end
31
31
 
32
32
  it 'searches for nearby points with given boost' do
33
33
  search do
34
34
  with(:coordinates).near(40.7, -73.5, :boost => 2.0)
35
35
  end
36
- connection.should have_last_search_including(:q, build_geo_query(:boost => 2.0))
36
+ expect(connection).to have_last_search_including(:q, build_geo_query(:boost => 2.0))
37
37
  end
38
38
 
39
39
  it 'performs both dismax search and location search' do
@@ -42,7 +42,7 @@ shared_examples_for 'geohash query' do
42
42
  with(:coordinates).near(40.7, -73.5)
43
43
  end
44
44
  expected = %Q((_query_:"{!edismax qf='title_text'}pizza" AND (#{build_geo_query})))
45
- connection.should have_last_search_including(:q, expected)
45
+ expect(connection).to have_last_search_including(:q, expected)
46
46
  end
47
47
 
48
48
  private
@@ -6,8 +6,8 @@ describe "grouping" do
6
6
  group :title
7
7
  end
8
8
 
9
- connection.should have_last_search_including(:group, "true")
10
- connection.should have_last_search_including(:"group.field", "title_ss")
9
+ expect(connection).to have_last_search_including(:group, "true")
10
+ expect(connection).to have_last_search_including(:"group.field", "title_ss")
11
11
  end
12
12
 
13
13
  it "sends grouping limit parameters to solr" do
@@ -17,7 +17,7 @@ describe "grouping" do
17
17
  end
18
18
  end
19
19
 
20
- connection.should have_last_search_including(:"group.limit", 2)
20
+ expect(connection).to have_last_search_including(:"group.limit", 2)
21
21
  end
22
22
 
23
23
  it "sends grouping sort parameters to solr" do
@@ -27,7 +27,7 @@ describe "grouping" do
27
27
  end
28
28
  end
29
29
 
30
- connection.should have_last_search_including(:"group.sort", "average_rating_ft asc")
30
+ expect(connection).to have_last_search_including(:"group.sort", "average_rating_ft asc")
31
31
  end
32
32
 
33
33
  it "sends grouping field parameters to solr" do
@@ -37,7 +37,7 @@ describe "grouping" do
37
37
  end
38
38
  end
39
39
 
40
- connection.should have_last_search_including(:"group.field", "title_ss")
40
+ expect(connection).to have_last_search_including(:"group.field", "title_ss")
41
41
  end
42
42
 
43
43
  it "sends grouping query parameters to solr" do
@@ -49,6 +49,6 @@ describe "grouping" do
49
49
  end
50
50
  end
51
51
 
52
- connection.should have_last_search_including(:"group.query", "category_ids_im:1")
52
+ expect(connection).to have_last_search_including(:"group.query", "category_ids_im:1")
53
53
  end
54
54
  end
@@ -3,21 +3,21 @@ shared_examples_for "query with highlighting support" do
3
3
  search do
4
4
  keywords 'test'
5
5
  end
6
- connection.should_not have_last_search_with(:hl)
6
+ expect(connection).not_to have_last_search_with(:hl)
7
7
  end
8
8
 
9
9
  it 'should enable highlighting when highlighting requested as keywords argument' do
10
10
  search do
11
11
  keywords 'test', :highlight => true
12
12
  end
13
- connection.should have_last_search_with(:hl => 'on')
13
+ expect(connection).to have_last_search_with(:hl => 'on')
14
14
  end
15
15
 
16
16
  it 'should not set highlight fields parameter if highlight fields are not passed' do
17
17
  search do
18
18
  keywords 'test', :highlight => true, :fields => [:title]
19
19
  end
20
- connection.should_not have_last_search_with(:'hl.fl')
20
+ expect(connection).not_to have_last_search_with(:'hl.fl')
21
21
  end
22
22
 
23
23
  it 'should enable highlighting on multiple fields when highlighting requested as array of fields via keywords argument' do
@@ -25,15 +25,15 @@ shared_examples_for "query with highlighting support" do
25
25
  keywords 'test', :highlight => [:title, :body]
26
26
  end
27
27
 
28
- connection.should have_last_search_with(:hl => 'on', :'hl.fl' => %w(title_text body_textsv))
28
+ expect(connection).to have_last_search_with(:hl => 'on', :'hl.fl' => %w(title_text body_textsv))
29
29
  end
30
30
 
31
31
  it 'should raise UnrecognizedFieldError if try to highlight unexisting field via keywords argument' do
32
- lambda {
32
+ expect {
33
33
  search do
34
34
  keywords 'test', :highlight => [:unknown_field]
35
35
  end
36
- }.should raise_error(Sunspot::UnrecognizedFieldError)
36
+ }.to raise_error(Sunspot::UnrecognizedFieldError)
37
37
  end
38
38
 
39
39
  it 'should enable highlighting on multiple fields when highlighting requested as list of fields via block call' do
@@ -43,7 +43,7 @@ shared_examples_for "query with highlighting support" do
43
43
  end
44
44
  end
45
45
 
46
- connection.should have_last_search_with(:hl => 'on', :'hl.fl' => %w(title_text body_textsv))
46
+ expect(connection).to have_last_search_with(:hl => 'on', :'hl.fl' => %w(title_text body_textsv))
47
47
  end
48
48
 
49
49
  it 'should enable highlighting on multiple fields for multiple search types' do
@@ -52,24 +52,24 @@ shared_examples_for "query with highlighting support" do
52
52
  highlight :body
53
53
  end
54
54
  end
55
- connection.searches.last[:'hl.fl'].to_set.should == Set['body_text', 'body_textsv']
55
+ expect(connection.searches.last[:'hl.fl'].to_set).to eq(Set['body_text', 'body_textsv'])
56
56
  end
57
57
 
58
58
  it 'should raise UnrecognizedFieldError if try to highlight unexisting field via block call' do
59
- lambda {
59
+ expect {
60
60
  search do
61
61
  keywords 'test' do
62
62
  highlight :unknown_field
63
63
  end
64
64
  end
65
- }.should raise_error(Sunspot::UnrecognizedFieldError)
65
+ }.to raise_error(Sunspot::UnrecognizedFieldError)
66
66
  end
67
67
 
68
68
  it 'should set internal formatting' do
69
69
  search do
70
70
  keywords 'test', :highlight => true
71
71
  end
72
- connection.should have_last_search_with(
72
+ expect(connection).to have_last_search_with(
73
73
  :"hl.simple.pre" => '@@@hl@@@',
74
74
  :"hl.simple.post" => '@@@endhl@@@'
75
75
  )
@@ -81,7 +81,7 @@ shared_examples_for "query with highlighting support" do
81
81
  highlight :title
82
82
  end
83
83
  end
84
- connection.should have_last_search_with(
84
+ expect(connection).to have_last_search_with(
85
85
  :"hl.fl" => %w(title_text)
86
86
  )
87
87
  end
@@ -90,7 +90,7 @@ shared_examples_for "query with highlighting support" do
90
90
  search do
91
91
  keywords 'test', :highlight => :body
92
92
  end
93
- connection.should have_last_search_with(
93
+ expect(connection).to have_last_search_with(
94
94
  :"hl.simple.pre" => '@@@hl@@@',
95
95
  :"hl.simple.post" => '@@@endhl@@@'
96
96
  )
@@ -102,7 +102,7 @@ shared_examples_for "query with highlighting support" do
102
102
  highlight :max_snippets => 3
103
103
  end
104
104
  end
105
- connection.should have_last_search_with(
105
+ expect(connection).to have_last_search_with(
106
106
  :"hl.snippets" => 3
107
107
  )
108
108
  end
@@ -113,7 +113,7 @@ shared_examples_for "query with highlighting support" do
113
113
  highlight :title, :max_snippets => 3
114
114
  end
115
115
  end
116
- connection.should have_last_search_with(
116
+ expect(connection).to have_last_search_with(
117
117
  :"hl.fl" => %w(title_text),
118
118
  :"f.title_text.hl.snippets" => 3
119
119
  )
@@ -125,7 +125,7 @@ shared_examples_for "query with highlighting support" do
125
125
  highlight :fragment_size => 200
126
126
  end
127
127
  end
128
- connection.should have_last_search_with(
128
+ expect(connection).to have_last_search_with(
129
129
  :"hl.fragsize" => 200
130
130
  )
131
131
  end
@@ -136,7 +136,7 @@ shared_examples_for "query with highlighting support" do
136
136
  highlight :title, :fragment_size => 200
137
137
  end
138
138
  end
139
- connection.should have_last_search_with(
139
+ expect(connection).to have_last_search_with(
140
140
  :"f.title_text.hl.fragsize" => 200
141
141
  )
142
142
  end
@@ -147,7 +147,7 @@ shared_examples_for "query with highlighting support" do
147
147
  highlight :merge_contiguous_fragments => true
148
148
  end
149
149
  end
150
- connection.should have_last_search_with(
150
+ expect(connection).to have_last_search_with(
151
151
  :"hl.mergeContiguous" => 'true'
152
152
  )
153
153
  end
@@ -158,7 +158,7 @@ shared_examples_for "query with highlighting support" do
158
158
  highlight :title, :merge_contiguous_fragments => true
159
159
  end
160
160
  end
161
- connection.should have_last_search_with(
161
+ expect(connection).to have_last_search_with(
162
162
  :"f.title_text.hl.mergeContiguous" => 'true'
163
163
  )
164
164
  end
@@ -169,7 +169,7 @@ shared_examples_for "query with highlighting support" do
169
169
  highlight :phrase_highlighter => true
170
170
  end
171
171
  end
172
- connection.should have_last_search_with(
172
+ expect(connection).to have_last_search_with(
173
173
  :"hl.usePhraseHighlighter" => 'true'
174
174
  )
175
175
  end
@@ -180,7 +180,7 @@ shared_examples_for "query with highlighting support" do
180
180
  highlight :title, :phrase_highlighter => true
181
181
  end
182
182
  end
183
- connection.should have_last_search_with(
183
+ expect(connection).to have_last_search_with(
184
184
  :"f.title_text.hl.usePhraseHighlighter" => 'true'
185
185
  )
186
186
  end
@@ -191,7 +191,7 @@ shared_examples_for "query with highlighting support" do
191
191
  highlight :phrase_highlighter => true, :require_field_match => true
192
192
  end
193
193
  end
194
- connection.should have_last_search_with(
194
+ expect(connection).to have_last_search_with(
195
195
  :"hl.requireFieldMatch" => 'true'
196
196
  )
197
197
  end
@@ -202,7 +202,7 @@ shared_examples_for "query with highlighting support" do
202
202
  highlight :title, :phrase_highlighter => true, :require_field_match => true
203
203
  end
204
204
  end
205
- connection.should have_last_search_with(
205
+ expect(connection).to have_last_search_with(
206
206
  :"f.title_text.hl.requireFieldMatch" => 'true'
207
207
  )
208
208
  end
@@ -214,7 +214,7 @@ shared_examples_for "query with highlighting support" do
214
214
  highlight :body, :max_snippets => 1
215
215
  end
216
216
  end
217
- connection.should have_last_search_with(
217
+ expect(connection).to have_last_search_with(
218
218
  :"hl.fl" => %w(title_text body_textsv),
219
219
  :"f.title_text.hl.snippets" => 2,
220
220
  :"f.body_textsv.hl.snippets" => 1
@@ -227,7 +227,7 @@ shared_examples_for "query with highlighting support" do
227
227
  highlight :title, :formatter => 'formatter'
228
228
  end
229
229
  end
230
- connection.should have_last_search_with(
230
+ expect(connection).to have_last_search_with(
231
231
  :"f.title_text.hl.formatter" => 'formatter'
232
232
  )
233
233
  end
@@ -238,7 +238,7 @@ shared_examples_for "query with highlighting support" do
238
238
  highlight :title, :fragmenter => 'example_fragmenter'
239
239
  end
240
240
  end
241
- connection.should have_last_search_with(
241
+ expect(connection).to have_last_search_with(
242
242
  :"f.title_text.hl.fragmenter" => 'example_fragmenter'
243
243
  )
244
244
  end
@@ -5,7 +5,7 @@ describe 'join' do
5
5
  session.search PhotoContainer do
6
6
  with(:caption, 'blah')
7
7
  end
8
- connection.should have_last_search_including(
8
+ expect(connection).to have_last_search_including(
9
9
  :fq, "{!join from=photo_container_id_i to=id_i}caption_s:blah")
10
10
  end
11
11
 
@@ -13,7 +13,7 @@ describe 'join' do
13
13
  session.search PhotoContainer do
14
14
  with(:photo_rating).greater_than(3)
15
15
  end
16
- connection.should have_last_search_including(
16
+ expect(connection).to have_last_search_including(
17
17
  :fq, "{!join from=photo_container_id_i to=id_i}average_rating_ft:{3\\.0 TO *}")
18
18
  end
19
19
  end
@@ -16,42 +16,42 @@ describe 'more_like_this' do
16
16
  it 'should query passed in object' do
17
17
  p = Post.new
18
18
  session.more_like_this(p)
19
- connection.should have_last_search_with(:q => "id:Post\\ #{p.id}")
19
+ expect(connection).to have_last_search_with(:q => "id:Post\\ #{p.id}")
20
20
  end
21
21
 
22
22
  it 'should use more_like_this fields if no fields specified' do
23
23
  session.more_like_this(Post.new)
24
- connection.searches.last[:"mlt.fl"].split(',').sort.should == %w(body_textsv tags_textv)
24
+ expect(connection.searches.last[:"mlt.fl"].split(',').sort).to eq(%w(body_textsv tags_textv))
25
25
  end
26
26
 
27
27
  it 'should use more_like_this fields if specified' do
28
28
  session.more_like_this(Post.new) do
29
29
  fields :body
30
30
  end
31
- connection.should have_last_search_with(:"mlt.fl" => "body_textsv")
31
+ expect(connection).to have_last_search_with(:"mlt.fl" => "body_textsv")
32
32
  end
33
33
 
34
34
  it 'assigns boosts to fields when specified' do
35
35
  session.more_like_this(Post.new) do
36
36
  fields :body, :tags => 8
37
37
  end
38
- connection.searches.last[:"mlt.fl"].split(',').sort.should == %w(body_textsv tags_textv)
39
- connection.should have_last_search_with(:"mlt.qf" => "tags_textv^8")
38
+ expect(connection.searches.last[:"mlt.fl"].split(',').sort).to eq(%w(body_textsv tags_textv))
39
+ expect(connection).to have_last_search_with(:"mlt.qf" => "tags_textv^8")
40
40
  end
41
41
 
42
42
  it 'doesn\'t assign boosts to fields when not specified' do
43
43
  session.more_like_this(Post.new) do
44
44
  fields :body
45
45
  end
46
- connection.should_not have_last_search_with(:qf)
46
+ expect(connection).not_to have_last_search_with(:qf)
47
47
  end
48
48
 
49
49
  it 'should raise ArgumentError if a field is not setup for more_like_this' do
50
- lambda do
50
+ expect do
51
51
  session.more_like_this(Post.new) do
52
52
  fields :title
53
53
  end
54
- end.should raise_error(ArgumentError)
54
+ end.to raise_error(ArgumentError)
55
55
  end
56
56
 
57
57
  it 'should accept options' do
@@ -63,12 +63,12 @@ describe 'more_like_this' do
63
63
  maximum_query_terms 5
64
64
  boost_by_relevance false
65
65
  end
66
- connection.should have_last_search_with(:"mlt.mintf" => 1)
67
- connection.should have_last_search_with(:"mlt.mindf" => 2)
68
- connection.should have_last_search_with(:"mlt.minwl" => 3)
69
- connection.should have_last_search_with(:"mlt.maxwl" => 4)
70
- connection.should have_last_search_with(:"mlt.maxqt" => 5)
71
- connection.should have_last_search_with(:"mlt.boost" => false)
66
+ expect(connection).to have_last_search_with(:"mlt.mintf" => 1)
67
+ expect(connection).to have_last_search_with(:"mlt.mindf" => 2)
68
+ expect(connection).to have_last_search_with(:"mlt.minwl" => 3)
69
+ expect(connection).to have_last_search_with(:"mlt.maxwl" => 4)
70
+ expect(connection).to have_last_search_with(:"mlt.maxqt" => 5)
71
+ expect(connection).to have_last_search_with(:"mlt.boost" => false)
72
72
  end
73
73
 
74
74
  it 'should accept short options' do
@@ -80,45 +80,45 @@ describe 'more_like_this' do
80
80
  maxqt 5
81
81
  boost true
82
82
  end
83
- connection.should have_last_search_with(:"mlt.mintf" => 1)
84
- connection.should have_last_search_with(:"mlt.mindf" => 2)
85
- connection.should have_last_search_with(:"mlt.minwl" => 3)
86
- connection.should have_last_search_with(:"mlt.maxwl" => 4)
87
- connection.should have_last_search_with(:"mlt.maxqt" => 5)
88
- connection.should have_last_search_with(:"mlt.boost" => true)
83
+ expect(connection).to have_last_search_with(:"mlt.mintf" => 1)
84
+ expect(connection).to have_last_search_with(:"mlt.mindf" => 2)
85
+ expect(connection).to have_last_search_with(:"mlt.minwl" => 3)
86
+ expect(connection).to have_last_search_with(:"mlt.maxwl" => 4)
87
+ expect(connection).to have_last_search_with(:"mlt.maxqt" => 5)
88
+ expect(connection).to have_last_search_with(:"mlt.boost" => true)
89
89
  end
90
90
 
91
91
  it 'paginates using default per_page when page not provided' do
92
92
  session.more_like_this(Post.new)
93
- connection.should have_last_search_with(:rows => 30)
93
+ expect(connection).to have_last_search_with(:rows => 30)
94
94
  end
95
95
 
96
96
  it 'paginates using default per_page when page provided' do
97
97
  session.more_like_this(Post.new) do
98
98
  paginate :page => 2
99
99
  end
100
- connection.should have_last_search_with(:rows => 30, :start => 30)
100
+ expect(connection).to have_last_search_with(:rows => 30, :start => 30)
101
101
  end
102
102
 
103
103
  it 'paginates using provided per_page' do
104
104
  session.more_like_this(Post.new) do
105
105
  paginate :page => 4, :per_page => 15
106
106
  end
107
- connection.should have_last_search_with(:rows => 15, :start => 45)
107
+ expect(connection).to have_last_search_with(:rows => 15, :start => 45)
108
108
  end
109
109
 
110
110
  it 'defaults to page 1 if no :page argument given' do
111
111
  session.more_like_this(Post.new) do
112
112
  paginate :per_page => 15
113
113
  end
114
- connection.should have_last_search_with(:rows => 15, :start => 0)
114
+ expect(connection).to have_last_search_with(:rows => 15, :start => 0)
115
115
  end
116
116
 
117
117
  it 'paginates from string argument' do
118
118
  session.more_like_this(Post.new) do
119
119
  paginate :page => '3', :per_page => '15'
120
120
  end
121
- connection.should have_last_search_with(:rows => 15, :start => 30)
121
+ expect(connection).to have_last_search_with(:rows => 15, :start => 30)
122
122
  end
123
123
 
124
124
  it "should send query to solr with adjusted parameters (keyword example)" do
@@ -128,8 +128,8 @@ describe 'more_like_this' do
128
128
  params[:some] = 'param'
129
129
  end
130
130
  end
131
- connection.should have_last_search_with(:q => 'new search')
132
- connection.should have_last_search_with(:some => 'param')
131
+ expect(connection).to have_last_search_with(:q => 'new search')
132
+ expect(connection).to have_last_search_with(:some => 'param')
133
133
  end
134
134
 
135
135
  it "should send query to solr with adjusted parameters in multiple blocks" do
@@ -141,8 +141,8 @@ describe 'more_like_this' do
141
141
  params[:some] = 'param'
142
142
  end
143
143
  end
144
- connection.should have_last_search_with(:q => 'new search')
145
- connection.should have_last_search_with(:some => 'param')
144
+ expect(connection).to have_last_search_with(:q => 'new search')
145
+ expect(connection).to have_last_search_with(:some => 'param')
146
146
  end
147
147
 
148
148
  private