Sha256: 81c016dd6fe10abe6facfc4ccdbf527ac9cdf9cf5df1f6957362e23820c43795

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 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#flush' do

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

  let(:params) do
    {}
  end

  let(:url) do
    '_flush'
  end

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

  context 'when an index is specified' do

    let(:url) do
      'foo/_flush'
    end

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

  context 'when multiple indices are specified' do

    let(:url) do
      'foo,bar/_flush'
    end

    it 'performs the request' do
      expect(client_double.indices.flush(index: ['foo','bar'])).to eq({})
    end
  end

  context 'when the path needs to be URL-escaped' do

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

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

  context 'when URL parameters are specified' do

    let(:url) do
      'foo/_flush'
    end

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
elasticsearch-api-6.8.3 spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-6.8.2 spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.6.0 spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.6.0.pre spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.5.0 spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.5.0.pre.pre spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.4.0 spec/elasticsearch/api/actions/indices/flush_spec.rb
elasticsearch-api-7.3.0 spec/elasticsearch/api/actions/indices/flush_spec.rb