spec/elasticsearch/api/actions/indices/segments_spec.rb in elasticsearch-api-8.10.0 vs spec/elasticsearch/api/actions/indices/segments_spec.rb in elasticsearch-api-8.11.0

- old
+ new

@@ -23,11 +23,12 @@ [ 'GET', url, params, body, - {} + {}, + { endpoint: 'indices.segments' } ] end let(:url) do '_segments' @@ -49,10 +50,21 @@ let(:url) do 'foo/_segments' end + let(:expected_args) do + [ + 'GET', + url, + params, + body, + {}, + { defined_params: { index: 'foo' }, endpoint: 'indices.segments' } + ] + end + it 'performs the request' do expect(client_double.indices.segments(index: 'foo')).to be_a Elasticsearch::API::Response end end @@ -60,10 +72,21 @@ let(:url) do 'foo,bar/_segments' end + let(:expected_args) do + [ + 'GET', + url, + params, + body, + {}, + { defined_params: { index: ['foo', 'bar'] }, endpoint: 'indices.segments' } + ] + end + it 'performs the request' do expect(client_double.indices.segments(index: ['foo', 'bar'])).to be_a Elasticsearch::API::Response end end @@ -71,18 +94,40 @@ let(:url) do 'foo,bar/_segments' end + let(:expected_args) do + [ + 'GET', + url, + params, + body, + {}, + { defined_params: { index: 'foo,bar' }, endpoint: 'indices.segments' } + ] + end + it 'performs the request' do expect(client_double.indices.segments(index: 'foo,bar')).to be_a Elasticsearch::API::Response end end context 'when the path needs to be URL-escaped' do let(:url) do 'foo%5Ebar/_segments' + end + + let(:expected_args) do + [ + 'GET', + url, + params, + body, + {}, + { defined_params: { index: 'foo^bar' }, endpoint: 'indices.segments' } + ] end it 'performs the request' do expect(client_double.indices.segments(index: 'foo^bar')).to be_a Elasticsearch::API::Response end