spec/elasticsearch/api/actions/explain_document_spec.rb in elasticsearch-api-7.8.1 vs spec/elasticsearch/api/actions/explain_document_spec.rb in elasticsearch-api-7.9.0.pre
- old
+ new
@@ -16,21 +16,22 @@
# under the License.
require 'spec_helper'
describe 'client#explain' do
-
let(:expected_args) do
[
- 'GET',
- url,
- params,
- body,
- {}
+ method,
+ url,
+ params,
+ body,
+ {}
]
end
+ let(:method) { 'POST' }
+
let(:params) do
{}
end
let(:body) do
@@ -60,11 +61,11 @@
it 'performs the request' do
expect(client_double.explain(index: 'foo', type: 'bar', id: 1, body: {})).to eq({})
end
context 'when a query is provided' do
-
+ let(:method) { 'GET' }
let(:params) do
{ q: 'abc123' }
end
let(:body) do
@@ -75,21 +76,19 @@
expect(client_double.explain(index: 'foo', type: 'bar', id: '1', q: 'abc123')).to eq({})
end
end
context 'when a query definition is provided' do
-
let(:body) do
{ query: { match: {} } }
end
it 'passes the query definition' do
expect(client_double.explain(index: 'foo', type: 'bar', id: '1', body: { query: { match: {} } })).to eq({})
end
end
context 'when the request needs to be URL-escaped' do
-
let(:url) do
'foo%5Ebar/bar%2Fbam/1/_explain'
end
it 'URL-escapes the parts' do