ActionController::UnknownFormat with rspec and post request
You're using json
format in controller, but you're passing format: :js
in the test.
It should be:
post sensors_path, sensor: @sensor_attributes, format: :json
This is for future readers. Somehow the answer did not help me.
Writing like following worked for me -
params = {
sensor: {
name: "Testname",
description: "This is a Test-Description."
},
format: :json
}
post sensors_path, params