Methods
- A
- R
Instance Public methods
app() Link
app=(app) Link
register_encoder(mime_name, param_encoder: nil, response_parser: nil, content_type: nil) Link
Registers an encoder used to parse the response body returned by TestResponse#parsed_body. IntegrationTest encodes and parses :html and :json requests by default.
Arguments¶ ↑
-
mime_name- The MIME-compatible name
Options¶ ↑
-
:param_encoder- A callable that accepts aHashand returns an encoded value -
:response_parser- A callable that accepts the bodyStringand returns a parsed value -
:content_type- TheStringMIME type of the request body
Example¶ ↑
ActionDispatch::IntegrationTest.register_encoder :csv, param_encoder: -> params { params.map(&:to_csv).join("\n") }, response_parser: -> body { CSV.parse(body) }