Sha256: 7af23ce54da591c1b04ae7ecabae50aa800754805c328736bc5a071a5d01a806

Contents?: true

Size: 1.73 KB

Versions: 11

Compression:

Stored size: 1.73 KB

Contents

require 'test_helper'

module Elasticsearch
  module Test
    class IndicesPutSettingsTest < ::Test::Unit::TestCase

      context "Indices: Put settings" do
        subject { FakeClient.new }

        should "require the :body argument" do
          assert_raise ArgumentError do
            subject.indices.put_settings
          end
        end

        should "perform correct request" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'PUT', method
            assert_equal '_settings', url
            assert_equal Hash.new, params
            assert_equal Hash.new, body
            true
          end.returns(FakeResponse.new)

          subject.indices.put_settings :body => {}
        end

        should "perform request against a specific indices" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo/_settings', url
            true
          end.returns(FakeResponse.new)

          subject.indices.put_settings :index => 'foo', :body => {}
        end

        should "perform request against multiple indices" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo,bar/_settings', url
            true
          end.returns(FakeResponse.new)

          subject.indices.put_settings :index => ['foo','bar'], :body => {}
        end

        should "URL-escape the parts" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo%5Ebar/_settings', url
            true
          end.returns(FakeResponse.new)

          subject.indices.put_settings :index => 'foo^bar', :body => {}
        end

      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
elasticsearch-api-0.4.11 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.10 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.9 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.8 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.7 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.6 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.5 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.4 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.3 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.2 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.4.1 test/unit/indices/put_settings_test.rb