summaryrefslogtreecommitdiff
path: root/rest-api-spec/utils/thor/templates/ruby/test.erb
diff options
context:
space:
mode:
Diffstat (limited to 'rest-api-spec/utils/thor/templates/ruby/test.erb')
-rw-r--r--rest-api-spec/utils/thor/templates/ruby/test.erb26
1 files changed, 26 insertions, 0 deletions
diff --git a/rest-api-spec/utils/thor/templates/ruby/test.erb b/rest-api-spec/utils/thor/templates/ruby/test.erb
new file mode 100644
index 0000000..0825d81
--- /dev/null
+++ b/rest-api-spec/utils/thor/templates/ruby/test.erb
@@ -0,0 +1,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