Sha256: dc68fb1c95a77e2f5e075c41b56743ef3f3ba26cb247a12c256616a88ef90f79

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 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

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticsearch-api-0.4.0 test/unit/indices/put_settings_test.rb
elasticsearch-api-0.0.2 test/unit/indices/put_settings_test.rb