Module: Kronk::Test::HelperMethods

Included in:
Kronk::Test
Defined in:
lib/kronk/test/helper_methods.rb

Overview

Kronk test helper methods to easily make and mock requests. Sets @kronk, @responses, @response, @datas, @data, and @diff instance variables.

Instance Method Summary collapse

Instance Method Details

#delete(uri1, uri2 = nil, options = {}) ⇒ Object

Do a delete request for one or two URIs. See Kronk#compare for all supported options.



43
44
45
# File 'lib/kronk/test/helper_methods.rb', line 43

def delete uri1, uri2=nil, options={}
  retrieve uri1, uri2, options.merge(:http_method => :delete)
end

#get(uri1, uri2 = nil, options = {}) ⇒ Object

Do a get request for one or two URIs. See Kronk#compare for all supported options.



16
17
18
# File 'lib/kronk/test/helper_methods.rb', line 16

def get uri1, uri2=nil, options={}
  retrieve uri1, uri2, options.merge(:http_method => :get)
end

#post(uri1, uri2 = nil, options = {}) ⇒ Object

Do a post request for one or two URIs. See Kronk#compare for all supported options.



25
26
27
# File 'lib/kronk/test/helper_methods.rb', line 25

def post uri1, uri2=nil, options={}
  retrieve uri1, uri2, options.merge(:http_method => :post)
end

#put(uri1, uri2 = nil, options = {}) ⇒ Object

Do a put request for one or two URIs. See Kronk#compare for all supported options.



34
35
36
# File 'lib/kronk/test/helper_methods.rb', line 34

def put uri1, uri2=nil, options={}
  retrieve uri1, uri2, options.merge(:http_method => :put)
end