Sha256: dc0cd72bea97ec29d86900dae6b5dcdf3f64504a853c020f33543fa3642976b9

Contents?: true

Size: 1.24 KB

Versions: 87

Compression:

Stored size: 1.24 KB

Contents

require 'test_helper'

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

      context "Count" 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 '_count', url
            assert_equal Hash.new, params
            assert_nil body
            true
          end.returns(FakeResponse.new)

          subject.count
        end

        should "encode indices and types" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'GET', method
            assert_equal 'foo,bar/t1,t2/_count', url
            true
          end.returns(FakeResponse.new)

          subject.count :index => ['foo','bar'], :type => ['t1','t2']
        end

        should "take the query" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'GET', method
            assert_equal( {:match => {:foo => 'bar'}}, body)
            true
          end.returns(FakeResponse.new)

          subject.count :body => { :match => { :foo => 'bar' } }
        end

      end

    end
  end
end

Version data entries

87 entries across 87 versions & 6 rubygems

Version Path
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/elasticsearch-api-5.0.4/test/unit/count_test.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/elasticsearch-api-5.0.4/test/unit/count_test.rb
elasticsearch-api-5.0.4 test/unit/count_test.rb
elasticsearch-api-2.0.2 test/unit/count_test.rb
elasticsearch-api-5.0.3 test/unit/count_test.rb
elasticsearch-api-5.0.2 test/unit/count_test.rb
elasticsearch-api-5.0.1 test/unit/count_test.rb
elasticsearch-api-2.0.1 test/unit/count_test.rb
elasticsearch-api-1.1.2 test/unit/count_test.rb
elasticsearch-api-1.1.1 test/unit/count_test.rb
elasticsearch-api-5.0.0 test/unit/count_test.rb
elasticsearch-api-5.0.0.pre test/unit/count_test.rb
elasticsearch-api-2.0.0 test/unit/count_test.rb
elasticsearch-api-1.1.0 test/unit/count_test.rb
elasticsearch-api-2.0.0.pre test/unit/count_test.rb
elasticsearch-api-1.1.pre test/unit/count_test.rb
elasticsearch-api-1.0.18 test/unit/count_test.rb
elasticsearch-api-1.0.17 test/unit/count_test.rb
elasticsearch-api-1.0.16 test/unit/count_test.rb
elasticsearch-api-1.0.16.pre2 test/unit/count_test.rb