spec/integration/app-search/elasticsearch_search_spec.rb [25:51]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    let(:documents) do
      [
        { title: 'Beasts Before Us', author: 'Elsa Panciroli' },
        { title: 'The Rise and Fall of the Dinosaurs', author: 'Steve Brusatte' },
        { title: 'Raptor Red', author: 'Robert T. Bakker' },
        { title: 'The Earth: A biography of life', author: 'Dr. Elsa Panciroli' }
      ]
    end
    let(:api_key_name) { 'my-api-key' }

    before do
      # Use API Key in client, save a backup to restore original auth:
      @old_client = @client.dup
      api_key_body = { name: api_key_name, type: 'private', read: true, write: true, access_all_engines: true }
      response = client.create_api_key(body: api_key_body)
      @client.http_auth = response.body['key']
      create_engine(engine_name)
      client.index_documents(engine_name, documents: documents)
      sleep 1
    end

    after do
      # Restore original client:
      @client = @old_client
      delete_engines
      client.delete_api_key(api_key_name: api_key_name)
    end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



spec/integration/app-search/explain_search_spec.rb [25:51]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    let(:documents) do
      [
        { title: 'Beasts Before Us', author: 'Elsa Panciroli' },
        { title: 'The Rise and Fall of the Dinosaurs', author: 'Steve Brusatte' },
        { title: 'Raptor Red', author: 'Robert T. Bakker' },
        { title: 'The Earth: A biography of life', author: 'Dr. Elsa Panciroli' }
      ]
    end
    let(:api_key_name) { 'my-api-key' }

    before do
      # Use API Key in client, save a backup to restore original auth:
      @old_client = @client.dup
      api_key_body = { name: api_key_name, type: 'private', read: true, write: true, access_all_engines: true }
      response = client.create_api_key(body: api_key_body)
      @client.http_auth = response.body['key']
      create_engine(engine_name)
      client.index_documents(engine_name, documents: documents)
      sleep 1
    end

    after do
      # Restore original client:
      @client = @old_client
      delete_engines
      client.delete_api_key(api_key_name: api_key_name)
    end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



