Commit 5e7924d
Merge #316
316: Create a helper module to reduce test duplication r=brunoocasali a=brunoocasali
The general idea is to change tests from this:
```rb
it 'searches with index with searchableAttributes setting' do
response = index.update_searchable_attributes(['title', 'info.comment'])
index.wait_for_task(response['uid'])
response = index.add_documents(documents)
index.wait_for_task(response['uid'])
response = index.search('An awesome')
expect(response['hits'].count).to eq(1)
end
```
to this:
```rb
it 'searches with index with searchableAttributes setting' do
index.update_searchable_attributes(['title', 'info.comment']).then(&method(:wait_for_it))
index.add_documents(documents).then(&method(:wait_for_it))
response = index.search('An awesome')
expect(response['hits'].count).to eq(1)
end
```
or this:
```rb
it 'searches with index with searchableAttributes setting' do
wait_for_it index.update_searchable_attributes(['title', 'info.comment'])
wait_for_it index.add_documents(documents)
response = index.search('An awesome')
expect(response['hits'].count).to eq(1)
end
```
Co-authored-by: Bruno Casali <[email protected]>2 files changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments