You will get this error if your controller only displays JSON or XML, but you do not specify a format in the specification; your request is then used by default for unsupported HTML. In this case, just specify the supported format when you call the controller method from your specification. For example, change this:
post :create, registration: @user_hash
:
post :create, registration: @user_hash, format: :json
Jason source share