This blog is part of our Rails 5 series.
Before Rails 5,
while sending requests with integration test setup,
we needed to add
format option to send request with different
This format for writing tests with
is lengthy and needs too much information to be passed to request as well.
Improvement with Rails 5
In Rails 5,
we can provide
Mime type while sending request
by passing it with as option
and all the other information like
headers and format will be passed automatically.
As we can notice,
we don’t need to parse JSON anymore.
With changes in this PR,
we can fetch parsed response without needing to call
JSON.parse at all.
Custom Mime Type
We can also register our own encoders
for any registered