module HttpTest::HttpMethods

:status - HTTP response status code, such as 200 :body - the response body :response_headers

Attributes

response[R]

Public Instance Methods

DELETE(path) click to toggle source
# File lib/http-test/http_methods.rb, line 69
def DELETE(path)
  @response = Response.create Faraday.delete(url(path))
end
GET(path) click to toggle source
# File lib/http-test/http_methods.rb, line 57
def GET(path)
  @response = Response.create Faraday.get(url(path))
end
HEAD(path) click to toggle source

rubocop:disable Style/MethodName

# File lib/http-test/http_methods.rb, line 53
def HEAD(path)
  @response = Response.create Faraday.head(url(path))
end
POST(path, body = {}) click to toggle source
# File lib/http-test/http_methods.rb, line 61
def POST(path, body = {})
  @response = Response.create Faraday.post(url(path), body)
end
PUT(path, body = {}) click to toggle source
# File lib/http-test/http_methods.rb, line 65
def PUT(path, body = {})
  @response = Response.create Faraday.put(url(path), body)
end
asset_redirect_to(url) click to toggle source
# File lib/http-test/http_methods.rb, line 75
def asset_redirect_to(url)
  assert_equal(302, response.code)
  assert_equal(url, response.headers["location"])
end
url(path) click to toggle source
# File lib/http-test/http_methods.rb, line 46
def url(path)
  return path if path =~ /\Ahttp(s)?:/

  File.join(HttpTest.url_base, path)
end