|
276 | 276 | end |
277 | 277 | end |
278 | 278 |
|
279 | | - context 'Wrong primary-key (attribute does not exist) added when pushing documents' do |
| 279 | + context 'Wrong primary-key (attribute does not exist) when pushing documents' do |
280 | 280 | before(:all) do |
281 | 281 | @uid = SecureRandom.hex(4) |
282 | 282 | @client.create_index(@uid) |
|
289 | 289 | { unique: 3, id: 1, title: 'Le Rouge et le Noir' } |
290 | 290 | end |
291 | 291 |
|
292 | | - it 'adds the primary-key but not the documents' do |
| 292 | + it 'does not add the primary key and the documents either' do |
293 | 293 | response = index.update_documents(documents, 'objectId') |
294 | 294 | expect(response).to be_a(Hash) |
295 | 295 | expect(response).to have_key('updateId') |
296 | 296 | sleep(0.2) |
297 | | - expect(index.fetch_primary_key).to eq('objectId') |
298 | | - expect(index.get_update_status(response['updateId'])['status']).to eq('failed') |
299 | | - end |
300 | | - |
301 | | - it 'succeeds to add document with the primary-key' do |
302 | | - response = index.add_documents({ objectId: 1, title: 'Le Rouge et le Noir' }, 'id') |
303 | | - expect(response).to be_a(Hash) |
304 | | - expect(response).to have_key('updateId') |
305 | | - sleep(0.2) |
306 | | - expect(index.fetch_primary_key).to eq('objectId') |
307 | | - expect(index.get_update_status(response['updateId'])['status']).to eq('processed') |
308 | | - expect(index.documents.count).to eq(1) |
309 | | - end |
310 | | - |
311 | | - it 'does not take into account the new primary key' do |
312 | | - response = index.add_documents({ id: 2, title: 'Le Petit Prince' }, 'id') |
313 | | - expect(response).to be_a(Hash) |
314 | | - expect(response).to have_key('updateId') |
315 | | - sleep(0.2) |
316 | | - expect(index.fetch_primary_key).to eq('objectId') |
| 297 | + expect(index.fetch_primary_key).to be_nil |
317 | 298 | expect(index.get_update_status(response['updateId'])['status']).to eq('failed') |
318 | 299 | end |
319 | 300 | end |
320 | 301 |
|
321 | | - context 'Wrong primary-key (attribute bad formatted) added when pushing documents' do |
| 302 | + context 'Wrong primary-key (attribute bad formatted) when pushing documents' do |
322 | 303 | before(:all) do |
323 | 304 | @uid = SecureRandom.hex(4) |
324 | 305 | @client.create_index(@uid) |
|
331 | 312 | { id: 1, title: 'Le Rouge et le Noir' } |
332 | 313 | end |
333 | 314 |
|
334 | | - it 'adds the primary-key but not the documents' do |
| 315 | + it 'does not add the primary key and the documents either' do |
335 | 316 | response = index.add_documents(documents, 'title') |
336 | 317 | expect(response).to be_a(Hash) |
337 | 318 | expect(response).to have_key('updateId') |
338 | 319 | sleep(0.2) |
339 | | - expect(index.fetch_primary_key).to eq('title') |
| 320 | + expect(index.fetch_primary_key).to be_nil |
340 | 321 | expect(index.get_update_status(response['updateId'])['status']).to eq('failed') |
341 | 322 | expect(index.documents.count).to eq(0) |
342 | 323 | end |
|
0 commit comments