|
76 | 76 | end
|
77 | 77 |
|
78 | 78 | describe 'indexing a document' do
|
79 |
| - |
80 | 79 | let(:search_result) do
|
81 | 80 | Article.search('title:test')
|
82 | 81 | end
|
|
88 | 87 | end
|
89 | 88 |
|
90 | 89 | describe '#results' do
|
91 |
| - |
92 | 90 | let(:search_result) do
|
93 | 91 | Article.search('title:test')
|
94 | 92 | end
|
|
97 | 95 | expect(search_result.results.first).to be_a(Elasticsearch::Model::Response::Result)
|
98 | 96 | end
|
99 | 97 |
|
100 |
| - it 'prooperly loads the document' do |
| 98 | + it 'properly loads the document' do |
101 | 99 | expect(search_result.results.first.title).to eq('Test')
|
102 | 100 | end
|
103 | 101 |
|
104 | 102 | context 'when the result contains other data' do
|
105 |
| - |
106 | 103 | let(:search_result) do
|
107 | 104 | Article.search(query: { match: { title: 'test' } }, highlight: { fields: { title: {} } })
|
108 | 105 | end
|
|
119 | 116 | end
|
120 | 117 |
|
121 | 118 | describe '#records' do
|
122 |
| - |
123 | 119 | let(:search_result) do
|
124 | 120 | Article.search('title:test')
|
125 | 121 | end
|
|
134 | 130 | end
|
135 | 131 |
|
136 | 132 | describe 'Enumerable' do
|
137 |
| - |
138 | 133 | let(:search_result) do
|
139 | 134 | Article.search('title:test')
|
140 | 135 | end
|
|
149 | 144 | end
|
150 | 145 |
|
151 | 146 | describe '#id' do
|
152 |
| - |
153 | 147 | let(:search_result) do
|
154 | 148 | Article.search('title:test')
|
155 | 149 | end
|
|
173 | 167 | end
|
174 | 168 |
|
175 | 169 | describe 'search results order' do
|
176 |
| - |
177 | 170 | let(:search_result) do
|
178 | 171 | Article.search(query: { match: { title: 'code' }}, sort: { clicks: :desc })
|
179 | 172 | end
|
|
196 | 189 | end
|
197 | 190 |
|
198 | 191 | describe 'a paged collection' do
|
199 |
| - |
200 | 192 | let(:search_result) do
|
201 | 193 | Article.search(query: { match: { title: { query: 'test' } } },
|
202 | 194 | size: 2,
|
|
212 | 204 | end
|
213 | 205 |
|
214 | 206 | describe '#destroy' do
|
215 |
| - |
216 | 207 | before do
|
217 | 208 | Article.create!(title: 'destroy', body: '', clicks: 1)
|
218 | 209 | Article.__elasticsearch__.refresh_index!
|
|
233 | 224 | end
|
234 | 225 |
|
235 | 226 | describe 'full document updates' do
|
236 |
| - |
237 | 227 | before do
|
238 | 228 | article = Article.create!(title: 'update', body: '', clicks: 1)
|
239 | 229 | Article.__elasticsearch__.refresh_index!
|
|
254 | 244 | end
|
255 | 245 |
|
256 | 246 | describe 'attribute updates' do
|
257 |
| - |
258 | 247 | before do
|
259 | 248 | article = Article.create!(title: 'update', body: '', clicks: 1)
|
260 | 249 | Article.__elasticsearch__.refresh_index!
|
|
275 | 264 | end
|
276 | 265 |
|
277 | 266 | describe '#save' do
|
278 |
| - |
279 | 267 | before do
|
280 | 268 | article = Article.create!(title: 'save', body: '', clicks: 1)
|
281 | 269 |
|
|
302 | 290 | end
|
303 | 291 |
|
304 | 292 | describe 'a DSL search' do
|
305 |
| - |
306 | 293 | let(:search_result) do
|
307 | 294 | Article.search(query: { match: { title: { query: 'test' } } })
|
308 | 295 | end
|
|
314 | 301 | end
|
315 | 302 |
|
316 | 303 | describe 'chaining SQL queries on response.records' do
|
317 |
| - |
318 | 304 | let(:search_result) do
|
319 | 305 | Article.search(query: { match: { title: { query: 'test' } } })
|
320 | 306 | end
|
|
0 commit comments