Sha256: 0a80f1f7df25644fea42a083f0bb335d704212b83c6cb5ae12d3d6b41fe4addd

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information

require 'spec_helper'

describe 'client.indices#clear_cache' do

  let(:expected_args) do
    [
        'POST',
        url,
        params,
        nil,
        nil
    ]
  end

  let(:url) do
    '_cache/clear'
  end

  let(:params) do
    {}
  end

  it 'performs the request' do
    expect(client_double.indices.clear_cache).to eq({})
  end

  context 'when an index is specified' do

    let(:url) do
      'foo/_cache/clear'
    end

    let(:params) do
      { index: 'foo' }
    end

    it 'performs the request' do
      expect(client_double.indices.clear_cache(index: 'foo')).to eq({})
    end
  end

  context 'when params are specified' do

    let(:params) do
      { field_data: true }
    end

    it 'performs the request' do
      expect(client_double.indices.clear_cache(field_data: true)).to eq({})
    end
  end

  context 'when the path must be URL-escaped' do

    let(:url) do
      'foo%5Ebar/_cache/clear'
    end

    let(:params) do
      { index: 'foo^bar' }
    end

    it 'performs the request' do
      expect(client_double.indices.clear_cache(index: 'foo^bar')).to eq({})
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticsearch-api-6.8.3 spec/elasticsearch/api/actions/indices/clear_cache_spec.rb
elasticsearch-api-6.8.2 spec/elasticsearch/api/actions/indices/clear_cache_spec.rb