|
14 | 14 | public_key = client.keys['public'] |
15 | 15 | new_client = MeiliSearch::Client.new(URL, public_key) |
16 | 16 | expect do |
17 | | - new_client.index(test_uid).settings |
| 17 | + new_client.index(random_uid).settings |
18 | 18 | end.to raise_meilisearch_api_error_with(403, 'invalid_token', 'authentication_error') |
19 | 19 | end |
20 | 20 |
|
|
29 | 29 | it 'fails to search if no key used' do |
30 | 30 | new_client = MeiliSearch::Client.new(URL) |
31 | 31 | expect do |
32 | | - new_client.index(test_uid).settings |
| 32 | + new_client.index(random_uid).settings |
33 | 33 | end.to raise_meilisearch_api_error_with(401, 'missing_authorization_header', 'authentication_error') |
34 | 34 | end |
35 | 35 |
|
36 | 36 | it 'succeeds to search when using public key' do |
| 37 | + uid = random_uid |
37 | 38 | public_key = client.keys['public'] |
38 | | - index = client.create_index(test_uid) |
| 39 | + index = client.create_index(uid) |
39 | 40 | response = index.add_documents(title: 'Test') |
40 | 41 | index.wait_for_pending_update(response['updateId']) |
41 | 42 |
|
42 | 43 | new_client = MeiliSearch::Client.new(URL, public_key) |
43 | | - response = new_client.index(test_uid).search('test') |
| 44 | + response = new_client.index(uid).search('test') |
44 | 45 | expect(response).to have_key('hits') |
45 | 46 | end |
46 | 47 |
|
47 | 48 | it 'succeeds to get settings when using private key' do |
48 | | - client.create_index(test_uid) |
| 49 | + uid = random_uid |
| 50 | + client.create_index(uid) |
49 | 51 | private_key = client.keys['private'] |
50 | 52 | new_client = MeiliSearch::Client.new(URL, private_key) |
51 | | - response = new_client.index(test_uid).settings |
| 53 | + response = new_client.index(uid).settings |
52 | 54 | expect(response).to have_key('rankingRules') |
53 | 55 | end |
54 | 56 |
|
|
0 commit comments