OpenSearch/rest-api-spec/utils/thor/templates/ruby/test.erb

27 lines
892 B
Plaintext
Raw Normal View History

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