Module: HttpTest::HttpMethods
- Included in:
- TestCase
- Defined in:
- lib/http-test/http_methods.rb
Overview
:status - HTTP response status code, such as 200 :body - the response body :response_headers
Defined Under Namespace
Modules: Response
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #asset_redirect_to(url) ⇒ Object
- #DELETE(path) ⇒ Object
- #GET(path) ⇒ Object
-
#HEAD(path) ⇒ Object
rubocop:disable Style/MethodName.
- #POST(path, body = {}) ⇒ Object
- #PUT(path, body = {}) ⇒ Object
- #url(path) ⇒ Object
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
73 74 75 |
# File 'lib/http-test/http_methods.rb', line 73 def response @response end |
Instance Method Details
#asset_redirect_to(url) ⇒ Object
75 76 77 78 |
# 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 |
#DELETE(path) ⇒ Object
69 70 71 |
# File 'lib/http-test/http_methods.rb', line 69 def DELETE(path) @response = Response.create Faraday.delete(url(path)) end |
#GET(path) ⇒ Object
57 58 59 |
# File 'lib/http-test/http_methods.rb', line 57 def GET(path) @response = Response.create Faraday.get(url(path)) end |
#HEAD(path) ⇒ Object
rubocop:disable Style/MethodName
53 54 55 |
# File 'lib/http-test/http_methods.rb', line 53 def HEAD(path) @response = Response.create Faraday.head(url(path)) end |
#POST(path, body = {}) ⇒ Object
61 62 63 |
# File 'lib/http-test/http_methods.rb', line 61 def POST(path, body = {}) @response = Response.create Faraday.post(url(path), body) end |