Sha256: 5e1b835b922a46ba18e0cef37fe3079d80cb92732647625a63a6ffa86a6cb6ff

Contents?: true

Size: 1.87 KB

Versions: 25

Compression:

Stored size: 1.87 KB

Contents

require 'test_helper'

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

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

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

          subject.indices.status
        end

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

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

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

          subject.indices.status :index => ['foo','bar']
          subject.indices.status :index => 'foo,bar'
        end

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

          subject.indices.status :index => 'foo', :recovery => true
        end

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

          subject.indices.status :index => 'foo^bar'
        end

      end

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
elasticsearch-api-1.0.13 test/unit/indices/status_test.rb
elasticsearch-api-1.0.12 test/unit/indices/status_test.rb
elasticsearch-api-1.0.11 test/unit/indices/status_test.rb
elasticsearch-api-1.0.10 test/unit/indices/status_test.rb
elasticsearch-api-1.0.9 test/unit/indices/status_test.rb
elasticsearch-api-1.0.7 test/unit/indices/status_test.rb
elasticsearch-api-1.0.6 test/unit/indices/status_test.rb
elasticsearch-api-1.0.5 test/unit/indices/status_test.rb
elasticsearch-api-1.0.4 test/unit/indices/status_test.rb
elasticsearch-api-1.0.2 test/unit/indices/status_test.rb
elasticsearch-api-1.0.1 test/unit/indices/status_test.rb
elasticsearch-api-1.0.0 test/unit/indices/status_test.rb
elasticsearch-api-0.4.11 test/unit/indices/status_test.rb
elasticsearch-api-0.4.10 test/unit/indices/status_test.rb
elasticsearch-api-0.4.9 test/unit/indices/status_test.rb
elasticsearch-api-1.0.0.rc2 test/unit/indices/status_test.rb
elasticsearch-api-1.0.0.rc1 test/unit/indices/status_test.rb
elasticsearch-api-0.4.8 test/unit/indices/status_test.rb
elasticsearch-api-0.4.7 test/unit/indices/status_test.rb
elasticsearch-api-0.4.6 test/unit/indices/status_test.rb