Sha256: d8a28410b0902fb8c2bbbbafa44bd6f5fc5ecd54d4954ecfde0aba808ceec89a

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

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

      context "Nodes: Shutdown" do
        subject { FakeClient.new }

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

          subject.nodes.shutdown
        end

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

          subject.nodes.shutdown :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/_shutdown', url
            true
          end.returns(FakeResponse.new).twice

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

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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