summaryrefslogtreecommitdiff
path: root/rest-api-spec/utils/thor/templates/ruby/test.erb
blob: 0825d813c609f51b982ab17ea5466b39d2654c20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'test_helper'

module Elasticsearch
  module Test
    class <%= @module_namespace.empty? ? @method_name.camelize : @module_namespace.map {|n| n.capitalize}.join + @method_name.camelize %>Test < ::Test::Unit::TestCase

      context "<%= @module_namespace.empty? ? '' : @module_namespace.map {|n| n.capitalize}.join + ': ' %><%= @method_name.humanize %>" do
        subject { FakeClient.new(nil) }

        should "perform correct request" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'FAKE', method
            assert_equal 'test', url
            assert_equal Hash.new, params
            <%= @spec['body'].nil? ? 'assert_nil   body' : 'assert_equal Hash.new, body' %>
            true
          end.returns(FakeResponse.new)

          subject.<%= @full_namespace.join('.') %>
        end

      end

    end
  end
end