Sha256: 1f5efbd634795bfe22e6b1a4c1f5e97f4b3b760567a3d91fce4fd2237e2f620c

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

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

      context "Indices: Close" do
        subject { FakeClient.new }

        should "require the :index argument" do
          assert_raise ArgumentError do
            subject.indices.close
          end
        end

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

          subject.indices.close :index => 'foo'
        end

        should "pass the URL parameters" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo/_close', url
            assert_equal '1s', params[:timeout]
            true
          end.returns(FakeResponse.new)

          subject.indices.close :index => 'foo', :timeout => '1s'
        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/close_test.rb
elasticsearch-api-0.0.2 test/unit/indices/close_test.rb