Skip to content

Commit 2a6b09c

Browse files
committed
Replace test_uid usage with random_uid method
1 parent 530810e commit 2a6b09c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

spec/meilisearch/client/keys_spec.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
public_key = client.keys['public']
1515
new_client = MeiliSearch::Client.new(URL, public_key)
1616
expect do
17-
new_client.index(test_uid).settings
17+
new_client.index(random_uid).settings
1818
end.to raise_meilisearch_api_error_with(403, 'invalid_token', 'authentication_error')
1919
end
2020

@@ -29,26 +29,28 @@
2929
it 'fails to search if no key used' do
3030
new_client = MeiliSearch::Client.new(URL)
3131
expect do
32-
new_client.index(test_uid).settings
32+
new_client.index(random_uid).settings
3333
end.to raise_meilisearch_api_error_with(401, 'missing_authorization_header', 'authentication_error')
3434
end
3535

3636
it 'succeeds to search when using public key' do
37+
uid = random_uid
3738
public_key = client.keys['public']
38-
index = client.create_index(test_uid)
39+
index = client.create_index(uid)
3940
response = index.add_documents(title: 'Test')
4041
index.wait_for_pending_update(response['updateId'])
4142

4243
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')
4445
expect(response).to have_key('hits')
4546
end
4647

4748
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)
4951
private_key = client.keys['private']
5052
new_client = MeiliSearch::Client.new(URL, private_key)
51-
response = new_client.index(test_uid).settings
53+
response = new_client.index(uid).settings
5254
expect(response).to have_key('rankingRules')
5355
end
5456

spec/meilisearch/index/documents_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
RSpec.describe 'MeiliSearch::Index - Documents' do
4-
let(:index) { client.create_index(test_uid) }
4+
let(:index) { client.create_index(random_uid) }
55

66
context 'All basic tests with primary-key inference' do
77
let(:documents) do

spec/support/default_shared_context.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
RSpec.shared_context 'test defaults' do
44
let(:client) { MeiliSearch::Client.new(URL, MASTER_KEY) }
5-
let(:test_uid) { random_uid }
65

76
before do
87
clear_all_indexes(client)

0 commit comments

Comments
 (0)