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
@@ -1,70 +1,70 @@
1
1
  shared_examples_for 'sortable query' do
2
2
  it 'paginates using default per_page when page not provided' do
3
3
  search
4
- connection.should have_last_search_with(:rows => 30)
4
+ expect(connection).to have_last_search_with(:rows => 30)
5
5
  end
6
6
 
7
7
  it 'paginates using default per_page when page provided' do
8
8
  search do
9
9
  paginate :page => 2
10
10
  end
11
- connection.should have_last_search_with(:rows => 30, :start => 30)
11
+ expect(connection).to have_last_search_with(:rows => 30, :start => 30)
12
12
  end
13
13
 
14
14
  it 'paginates using provided per_page' do
15
15
  search do
16
16
  paginate :page => 4, :per_page => 15
17
17
  end
18
- connection.should have_last_search_with(:rows => 15, :start => 45)
18
+ expect(connection).to have_last_search_with(:rows => 15, :start => 45)
19
19
  end
20
20
 
21
21
  it 'defaults to page 1 if no :page argument given' do
22
22
  search do
23
23
  paginate :per_page => 15
24
24
  end
25
- connection.should have_last_search_with(:rows => 15, :start => 0)
25
+ expect(connection).to have_last_search_with(:rows => 15, :start => 0)
26
26
  end
27
27
 
28
28
  it 'paginates with an offset' do
29
29
  search do
30
30
  paginate :per_page => 15, :offset => 3
31
31
  end
32
- connection.should have_last_search_with(:rows => 15, :start => 3)
32
+ expect(connection).to have_last_search_with(:rows => 15, :start => 3)
33
33
  end
34
34
 
35
35
  it 'paginates with an offset as a string' do
36
36
  search do
37
37
  paginate :per_page => 15, :offset => '3'
38
38
  end
39
- connection.should have_last_search_with(:rows => 15, :start => 3)
39
+ expect(connection).to have_last_search_with(:rows => 15, :start => 3)
40
40
  end
41
41
 
42
42
  it 'paginates from string argument' do
43
43
  search do
44
44
  paginate :page => '3', :per_page => '15'
45
45
  end
46
- connection.should have_last_search_with(:rows => 15, :start => 30)
46
+ expect(connection).to have_last_search_with(:rows => 15, :start => 30)
47
47
  end
48
48
 
49
49
  it 'paginates with initial cursor' do
50
50
  search do
51
51
  paginate :cursor => '*', :per_page => 15
52
52
  end
53
- connection.should have_last_search_with(:rows => 15, :cursorMark => '*')
53
+ expect(connection).to have_last_search_with(:rows => 15, :cursorMark => '*')
54
54
  end
55
55
 
56
56
  it 'paginates with given cursor' do
57
57
  search do
58
58
  paginate :cursor => 'AoIIP4AAACxQcm9maWxlIDEwMTk='
59
59
  end
60
- connection.should have_last_search_with(:cursorMark => 'AoIIP4AAACxQcm9maWxlIDEwMTk=')
60
+ expect(connection).to have_last_search_with(:cursorMark => 'AoIIP4AAACxQcm9maWxlIDEwMTk=')
61
61
  end
62
62
 
63
63
  it 'orders by a single field' do
64
64
  search do
65
65
  order_by :average_rating, :desc
66
66
  end
67
- connection.should have_last_search_with(:sort => 'average_rating_ft desc')
67
+ expect(connection).to have_last_search_with(:sort => 'average_rating_ft desc')
68
68
  end
69
69
 
70
70
  it 'orders by multiple fields' do
@@ -72,80 +72,80 @@ shared_examples_for 'sortable query' do
72
72
  order_by :average_rating, :desc
73
73
  order_by :sort_title, :asc
74
74
  end
75
- connection.should have_last_search_with(:sort => 'average_rating_ft desc, sort_title_s asc')
75
+ expect(connection).to have_last_search_with(:sort => 'average_rating_ft desc, sort_title_s asc')
76
76
  end
77
77
 
78
78
  it 'orders by random' do
79
79
  search do
80
80
  order_by :random
81
81
  end
82
- connection.searches.last[:sort].should =~ /^random_\d+ asc$/
82
+ expect(connection.searches.last[:sort]).to match(/^random_\d+ asc$/)
83
83
  end
84
84
 
85
85
  it 'orders by random with declared direction' do
86
86
  search do
87
87
  order_by :random, :desc
88
88
  end
89
- connection.searches.last[:sort].should =~ /^random_\d+ desc$/
89
+ expect(connection.searches.last[:sort]).to match(/^random_\d+ desc$/)
90
90
  end
91
91
 
92
92
  it 'orders by random with provided seed value' do
93
93
  search do
94
94
  order_by :random, :seed => 9001
95
95
  end
96
- connection.searches.last[:sort].should =~ /^random_9001 asc$/
96
+ expect(connection.searches.last[:sort]).to match(/^random_9001 asc$/)
97
97
  end
98
98
 
99
99
  it 'orders by random with provided seed value and direction' do
100
100
  search do
101
101
  order_by :random, :seed => 12345, :direction => :desc
102
102
  end
103
- connection.searches.last[:sort].should =~ /^random_12345 desc$/
103
+ expect(connection.searches.last[:sort]).to match(/^random_12345 desc$/)
104
104
  end
105
105
 
106
106
  it 'orders by score' do
107
107
  search do
108
108
  order_by :score, :desc
109
109
  end
110
- connection.should have_last_search_with(:sort => 'score desc')
110
+ expect(connection).to have_last_search_with(:sort => 'score desc')
111
111
  end
112
112
 
113
113
  it 'orders by geodist' do
114
114
  search do
115
115
  order_by_geodist :coordinates_new, 32, -68, :desc
116
116
  end
117
- connection.should have_last_search_with(:sort => 'geodist(coordinates_new_ll,32,-68) desc')
117
+ expect(connection).to have_last_search_with(:sort => 'geodist(coordinates_new_ll,32,-68) desc')
118
118
  end
119
119
 
120
120
  it 'throws an ArgumentError if a bogus order direction is given' do
121
- lambda do
121
+ expect do
122
122
  search do
123
123
  order_by :sort_title, :sideways
124
124
  end
125
- end.should raise_error(ArgumentError)
125
+ end.to raise_error(ArgumentError)
126
126
  end
127
127
 
128
128
  it 'throws an UnrecognizedFieldError if :distance is given for sort' do
129
- lambda do
129
+ expect do
130
130
  search do
131
131
  order_by :distance, :asc
132
132
  end
133
- end.should raise_error(Sunspot::UnrecognizedFieldError)
133
+ end.to raise_error(Sunspot::UnrecognizedFieldError)
134
134
  end
135
135
 
136
136
  it 'does not allow ordering by multiple-value fields' do
137
- lambda do
137
+ expect do
138
138
  search do
139
139
  order_by :category_ids
140
140
  end
141
- end.should raise_error(ArgumentError)
141
+ end.to raise_error(ArgumentError)
142
142
  end
143
143
 
144
144
  it 'raises ArgumentError if bogus argument given to paginate' do
145
- lambda do
145
+ expect do
146
146
  search do
147
147
  paginate :page => 4, :ugly => :puppy
148
148
  end
149
- end.should raise_error(ArgumentError)
149
+ end.to raise_error(ArgumentError)
150
150
  end
151
151
  end
@@ -3,14 +3,14 @@ shared_examples_for "scoped query" do
3
3
  search do
4
4
  with :title, 'My Pet Post'
5
5
  end
6
- connection.should have_last_search_including(:fq, 'title_ss:My\ Pet\ Post')
6
+ expect(connection).to have_last_search_including(:fq, 'title_ss:My\ Pet\ Post')
7
7
  end
8
8
 
9
9
  it 'scopes by exact match with a special string' do
10
10
  search do
11
11
  with :title, 'OR'
12
12
  end
13
- connection.should have_last_search_including(:fq, 'title_ss:"OR"')
13
+ expect(connection).to have_last_search_including(:fq, 'title_ss:"OR"')
14
14
  end
15
15
 
16
16
  it 'scopes by exact match with time' do
@@ -18,7 +18,7 @@ shared_examples_for "scoped query" do
18
18
  search do
19
19
  with :published_at, time
20
20
  end
21
- connection.should have_last_search_including(
21
+ expect(connection).to have_last_search_including(
22
22
  :fq,
23
23
  'published_at_dt:1983\-07\-08T09\:00\:00Z'
24
24
  )
@@ -29,7 +29,7 @@ shared_examples_for "scoped query" do
29
29
  search do
30
30
  with :expire_date, date
31
31
  end
32
- connection.should have_last_search_including(
32
+ expect(connection).to have_last_search_including(
33
33
  :fq,
34
34
  'expire_date_d:1983\-07\-08T00\:00\:00Z'
35
35
  )
@@ -39,133 +39,133 @@ shared_examples_for "scoped query" do
39
39
  search do
40
40
  with :featured, false
41
41
  end
42
- connection.should have_last_search_including(:fq, 'featured_bs:false')
42
+ expect(connection).to have_last_search_including(:fq, 'featured_bs:false')
43
43
  end
44
44
 
45
45
  it 'scopes by less than match with float' do
46
46
  search do
47
47
  with(:average_rating).less_than 3.0
48
48
  end
49
- connection.should have_last_search_including(:fq, 'average_rating_ft:{* TO 3\.0}')
49
+ expect(connection).to have_last_search_including(:fq, 'average_rating_ft:{* TO 3\.0}')
50
50
  end
51
51
 
52
52
  it 'should quote string with space in a less than match' do
53
53
  search do
54
54
  with(:title).less_than('test value')
55
55
  end
56
- connection.should have_last_search_including(:fq, 'title_ss:{* TO "test\ value"}')
56
+ expect(connection).to have_last_search_including(:fq, 'title_ss:{* TO "test\ value"}')
57
57
  end
58
58
 
59
59
  it 'scopes by greater than match with float' do
60
60
  search do
61
61
  with(:average_rating).greater_than 3.0
62
62
  end
63
- connection.should have_last_search_including(:fq, 'average_rating_ft:{3\.0 TO *}')
63
+ expect(connection).to have_last_search_including(:fq, 'average_rating_ft:{3\.0 TO *}')
64
64
  end
65
65
 
66
66
  it 'scopes by short-form between match with integers' do
67
67
  search do
68
68
  with :blog_id, 2..4
69
69
  end
70
- connection.should have_last_search_including(:fq, 'blog_id_i:[2 TO 4]')
70
+ expect(connection).to have_last_search_including(:fq, 'blog_id_i:[2 TO 4]')
71
71
  end
72
72
 
73
73
  it 'scopes by between match with float' do
74
74
  search do
75
75
  with(:average_rating).between 2.0..4.0
76
76
  end
77
- connection.should have_last_search_including(:fq, 'average_rating_ft:[2\.0 TO 4\.0]')
77
+ expect(connection).to have_last_search_including(:fq, 'average_rating_ft:[2\.0 TO 4\.0]')
78
78
  end
79
79
 
80
80
  it 'scopes by any match with integer' do
81
81
  search do
82
82
  with(:category_ids).any_of [2, 7, 12]
83
83
  end
84
- connection.should have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
84
+ expect(connection).to have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
85
85
  end
86
86
 
87
87
  it 'scopes by short-form any-of match with integers' do
88
88
  search do
89
89
  with :category_ids, [2, 7, 12]
90
90
  end
91
- connection.should have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
91
+ expect(connection).to have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
92
92
  end
93
93
 
94
94
  it 'scopes by all match with integer' do
95
95
  search do
96
96
  with(:category_ids).all_of [2, 7, 12]
97
97
  end
98
- connection.should have_last_search_including(:fq, 'category_ids_im:(2 AND 7 AND 12)')
98
+ expect(connection).to have_last_search_including(:fq, 'category_ids_im:(2 AND 7 AND 12)')
99
99
  end
100
100
 
101
101
  it 'scopes by prefix match with string' do
102
102
  search do
103
103
  with(:title).starting_with('tes')
104
104
  end
105
- connection.should have_last_search_including(:fq, 'title_ss:tes*')
105
+ expect(connection).to have_last_search_including(:fq, 'title_ss:tes*')
106
106
  end
107
107
 
108
108
  it 'scopes by not equal match with string' do
109
109
  search do
110
110
  without :title, 'Bad Post'
111
111
  end
112
- connection.should have_last_search_including(:fq, '-title_ss:Bad\ Post')
112
+ expect(connection).to have_last_search_including(:fq, '-title_ss:Bad\ Post')
113
113
  end
114
114
 
115
115
  it 'scopes by not less than match with float' do
116
116
  search do
117
117
  without(:average_rating).less_than 3.0
118
118
  end
119
- connection.should have_last_search_including(:fq, '-average_rating_ft:{* TO 3\.0}')
119
+ expect(connection).to have_last_search_including(:fq, '-average_rating_ft:{* TO 3\.0}')
120
120
  end
121
121
 
122
122
  it 'scopes by not greater than match with float' do
123
123
  search do
124
124
  without(:average_rating).greater_than 3.0
125
125
  end
126
- connection.should have_last_search_including(:fq, '-average_rating_ft:{3\.0 TO *}')
126
+ expect(connection).to have_last_search_including(:fq, '-average_rating_ft:{3\.0 TO *}')
127
127
  end
128
128
 
129
129
  it 'scopes by not between match with shorthand' do
130
130
  search do
131
131
  without(:blog_id, 2..4)
132
132
  end
133
- connection.should have_last_search_including(:fq, '-blog_id_i:[2 TO 4]')
133
+ expect(connection).to have_last_search_including(:fq, '-blog_id_i:[2 TO 4]')
134
134
  end
135
135
 
136
136
  it 'scopes by not between match with float' do
137
137
  search do
138
138
  without(:average_rating).between 2.0..4.0
139
139
  end
140
- connection.should have_last_search_including(:fq, '-average_rating_ft:[2\.0 TO 4\.0]')
140
+ expect(connection).to have_last_search_including(:fq, '-average_rating_ft:[2\.0 TO 4\.0]')
141
141
  end
142
142
 
143
143
  it 'scopes by not any match with integer' do
144
144
  search do
145
145
  without(:category_ids).any_of [2, 7, 12]
146
146
  end
147
- connection.should have_last_search_including(:fq, '-category_ids_im:(2 OR 7 OR 12)')
147
+ expect(connection).to have_last_search_including(:fq, '-category_ids_im:(2 OR 7 OR 12)')
148
148
  end
149
149
 
150
150
  it 'scopes by not all match with integer' do
151
151
  search do
152
152
  without(:category_ids).all_of [2, 7, 12]
153
153
  end
154
- connection.should have_last_search_including(:fq, '-category_ids_im:(2 AND 7 AND 12)')
154
+ expect(connection).to have_last_search_including(:fq, '-category_ids_im:(2 AND 7 AND 12)')
155
155
  end
156
156
 
157
157
  it 'scopes by empty field' do
158
158
  search do
159
159
  with :average_rating, nil
160
160
  end
161
- connection.should have_last_search_including(:fq, '-average_rating_ft:[* TO *]')
161
+ expect(connection).to have_last_search_including(:fq, '-average_rating_ft:[* TO *]')
162
162
  end
163
163
 
164
164
  it 'scopes by non-empty field' do
165
165
  search do
166
166
  without :average_rating, nil
167
167
  end
168
- connection.should have_last_search_including(:fq, 'average_rating_ft:[* TO *]')
168
+ expect(connection).to have_last_search_including(:fq, 'average_rating_ft:[* TO *]')
169
169
  end
170
170
 
171
171
  it 'includes by object identity' do
@@ -173,7 +173,7 @@ shared_examples_for "scoped query" do
173
173
  search do
174
174
  with post
175
175
  end
176
- connection.should have_last_search_including(:fq, "id:(Post\\ #{post.id})")
176
+ expect(connection).to have_last_search_including(:fq, "id:(Post\\ #{post.id})")
177
177
  end
178
178
 
179
179
  it 'includes multiple objects passed as varargs by object identity' do
@@ -181,7 +181,7 @@ shared_examples_for "scoped query" do
181
181
  search do
182
182
  with post1, post2
183
183
  end
184
- connection.should have_last_search_including(
184
+ expect(connection).to have_last_search_including(
185
185
  :fq, "id:(Post\\ #{post1.id} OR Post\\ #{post2.id})"
186
186
  )
187
187
  end
@@ -191,7 +191,7 @@ shared_examples_for "scoped query" do
191
191
  search do
192
192
  with posts
193
193
  end
194
- connection.should have_last_search_including(
194
+ expect(connection).to have_last_search_including(
195
195
  :fq, "id:(Post\\ #{posts.first.id} OR Post\\ #{posts.last.id})"
196
196
  )
197
197
  end
@@ -201,7 +201,7 @@ shared_examples_for "scoped query" do
201
201
  search do
202
202
  without post
203
203
  end
204
- connection.should have_last_search_including(:fq, "-id:(Post\\ #{post.id})")
204
+ expect(connection).to have_last_search_including(:fq, "-id:(Post\\ #{post.id})")
205
205
  end
206
206
 
207
207
  it 'excludes multiple objects passed as varargs by object identity' do
@@ -209,7 +209,7 @@ shared_examples_for "scoped query" do
209
209
  search do
210
210
  without post1, post2
211
211
  end
212
- connection.should have_last_search_including(
212
+ expect(connection).to have_last_search_including(
213
213
  :fq,
214
214
  "-id:(Post\\ #{post1.id} OR Post\\ #{post2.id})"
215
215
  )
@@ -220,7 +220,7 @@ shared_examples_for "scoped query" do
220
220
  search do
221
221
  without posts
222
222
  end
223
- connection.should have_last_search_including(
223
+ expect(connection).to have_last_search_including(
224
224
  :fq,
225
225
  "-id:(Post\\ #{posts.first.id} OR Post\\ #{posts.last.id})"
226
226
  )
@@ -231,45 +231,45 @@ shared_examples_for "scoped query" do
231
231
  search Post, Namespaced::Comment do
232
232
  with :published_at, time
233
233
  end
234
- connection.should have_last_search_including(:fq, 'published_at_dt:1983\-07\-08T09\:00\:00Z')
234
+ expect(connection).to have_last_search_including(:fq, 'published_at_dt:1983\-07\-08T09\:00\:00Z')
235
235
  end
236
236
 
237
237
  it 'allows scoping on field not common to all types' do
238
238
  search Post, Namespaced::Comment do
239
239
  with :blog_id, 1
240
240
  end
241
- connection.should have_last_search_including(:fq, 'blog_id_i:1')
241
+ expect(connection).to have_last_search_including(:fq, 'blog_id_i:1')
242
242
  end
243
243
 
244
244
  it 'raises Sunspot::UnrecognizedFieldError if search scoped to field configured differently between types' do
245
- lambda do
245
+ expect do
246
246
  search Post, Namespaced::Comment do
247
247
  with :average_rating, 2.2 # this is a float in Post but an integer in Comment
248
248
  end
249
- end.should raise_error(Sunspot::UnrecognizedFieldError)
249
+ end.to raise_error(Sunspot::UnrecognizedFieldError)
250
250
  end
251
251
 
252
252
  it 'raises Sunspot::UnrecognizedFieldError for nonexistant fields in block scope' do
253
- lambda do
253
+ expect do
254
254
  search do
255
255
  with :bogus, 'Field'
256
256
  end
257
- end.should raise_error(Sunspot::UnrecognizedFieldError)
257
+ end.to raise_error(Sunspot::UnrecognizedFieldError)
258
258
  end
259
259
 
260
260
  it 'raises NoMethodError if bogus operator referenced' do
261
- lambda do
261
+ expect do
262
262
  search do
263
263
  with(:category_ids).resembling :bogus_condition
264
264
  end
265
- end.should raise_error(NoMethodError)
265
+ end.to raise_error(NoMethodError)
266
266
  end
267
267
 
268
268
  it 'should raise ArgumentError if more than two arguments passed to scope method' do
269
- lambda do
269
+ expect do
270
270
  search do
271
271
  with(:category_ids, 4, 5)
272
272
  end
273
- end.should raise_error(ArgumentError)
273
+ end.to raise_error(ArgumentError)
274
274
  end
275
275
  end