Sha256: ab94a51f3855502b2c98582ac0bafdd72adc29865c82f7f59babd479f8a74163

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require 'test_helper'

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

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

          subject.nodes.info
        end

        should "send :node_id correctly" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal '_nodes/foo', url
            true
          end.returns(FakeResponse.new)

          subject.nodes.info :node_id => 'foo'
        end

        should "send multiple :node_id-s correctly" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal '_nodes/A,B,C', url
            true
          end.returns(FakeResponse.new).twice

          subject.nodes.info :node_id => 'A,B,C'
          subject.nodes.info :node_id => ['A', 'B', 'C']
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elasticsearch-api-1.0.1 test/unit/nodes/info_test.rb
elasticsearch-api-1.0.0 test/unit/nodes/info_test.rb
elasticsearch-api-1.0.0.rc2 test/unit/nodes/info_test.rb
elasticsearch-api-1.0.0.rc1 test/unit/nodes/info_test.rb