Sha256: 7333628e1ae226e8d3382f9e568238c73c7ccdd7aad13a37f42c5a658c65323d

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

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

      context "Indices: Get warmer" do
        subject { FakeClient.new }

        should "require the :index argument" do
          assert_raise ArgumentError do
            subject.indices.get_warmer :name => 'foo'
          end
        end

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

          subject.indices.get_warmer :index => '_all'
        end

        should "return single warmer" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo/_warmer/bar', url
            true
          end.returns(FakeResponse.new)

          subject.indices.get_warmer :index => 'foo', :name => 'bar'
        end

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

          subject.indices.get_warmer :index => 'foo^bar', :name => 'bar/bam'
        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/get_warmer_test.rb
elasticsearch-api-0.4.10 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.9 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.8 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.7 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.6 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.5 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.4 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.3 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.2 test/unit/indices/get_warmer_test.rb
elasticsearch-api-0.4.1 test/unit/indices/get_warmer_test.rb