meilisearch-ruby icon indicating copy to clipboard operation
meilisearch-ruby copied to clipboard

Make tests aware that keys does not require a description to be created

Open brunoocasali opened this issue 3 years ago • 0 comments

Some tests are affected if some Key leaks from other contexts, breaking some unrelated tests, like this:

  3) MeiliSearch::Client - Keys When a client uses default key roles succeeds to get settings when using private key
     Failure/Error: let(:admin_key) { client.keys['results'].find { |k| k['description'].start_with? 'Default Admin' } }
     
     NoMethodError:
       undefined method `start_with?' for nil:NilClass
     
           let(:admin_key) { client.keys['results'].find { |k| k['description'].start_with? 'Default Admin' } }
  • The idea is to make the usage of the description of the key optional.

Some possible changes (not required):

  • We could remove the tests which rely on the order of the keys in the server and create keys when needed.
  • We could also, make the keys disposable after each test (like a database_cleaner hook).

brunoocasali avatar Feb 21 '22 20:02 brunoocasali