get(path, **args) public

Performs a GET request with the given parameters. See ActionDispatch::Integration::Session#process for more details.

Show source
Register or log in to add new notes.
November 5, 2012 - (v3.0.0 - v3.2.8)
0 thanks

Specifying an accept header in your tests

To specify an accept header, you need to pass it in the second hash like this:

get '/url', nil, {'HTTP_ACCEPT' => 'application/json'}

The documentation says everything is uppercased and HTTP_ is appended when necessary, but that wasn’t working for me.