Sha256: 9cae6dc69991d8b3138d61a9ab4fbd656f6e8787bee87dab1c96fb451e959580

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

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#put_script' do

  let(:expected_args) do
    [
        'PUT',
        url,
        { },
        { script: 'bar' }
    ]
  end

  let(:url) do
    '_scripts/groovy/foo'
  end

  it 'performs the request' do
    expect(client_double.put_script(lang: 'groovy', id: 'foo', body: { script: 'bar' })).to eq({})
  end

  context 'when the lang parameter is not provided' do

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

    it 'performs the request' do
      expect(client_double.put_script(id: 'foo', body: { script: 'bar' })).to eq({})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elasticsearch-api-6.8.3 spec/elasticsearch/api/actions/put_script_spec.rb
elasticsearch-api-6.8.2 spec/elasticsearch/api/actions/put_script_spec.rb
elasticsearch-api-7.4.0 spec/elasticsearch/api/actions/put_script_spec.rb
elasticsearch-api-7.3.0 spec/elasticsearch/api/actions/put_script_spec.rb