you should also check if response is JSON. Like here: https://github.com/gotar/Internship-calendar-API/blob/ae7df1e882000727fdf72bfd1533be2af5f451f3/spec/integration/update_user_spec.rb#L16-L18