Sha256: 1cafe3207a8f476090c0160e6bee34aa88fef2e509e2c8b7e8b8255b058cde09

Contents?: true

Size: 1.16 KB

Versions: 68

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

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

      context "Indices: Get template" 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 '_template/foo', url
            assert_equal Hash.new, params
            assert_nil   body
            true
          end.returns(FakeResponse.new)

          subject.indices.get_template :name => 'foo'
        end

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

          subject.indices.get_template :name => 'foo^bar'
        end

        should "catch a NotFound exception with the ignore parameter" do
          subject.expects(:perform_request).raises(NotFound)

          assert_nothing_raised do
            subject.get_template :id => 1, :ignore => 404
          end
        end

      end

    end
  end
end

Version data entries

68 entries across 68 versions & 6 rubygems

Version Path
elasticsearch-api-1.0.16.pre test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.15 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.14 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.13 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.12 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.11 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.10 test/unit/indices/get_template_test.rb
elasticsearch-api-1.0.9 test/unit/indices/get_template_test.rb